#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

// Loops
#define FOR(n)              for(int i=0;i<n;i++)
#define FORJ(n)             for(int j=0;j<n;j++)
#define FORN(n,x)           for(int x=0;i<n;i++)
#define RFOR(n)             for(int i=n-1;i>=0;i--)
#define RFORJ(n)            for(int j=n-1;j>=0;j--)
#define RFORN(n,x)          for(int x=n-1;x>=0;x--)
#define ODD_FOR(n)          for(int i=1;i<n;i+=2)
#define EVEN_FOR(n)         for(int i=2;i<n;i+=2)
#define FROM(n,m)           for(int i=n;i<m;i++)
#define FROMJ(n,m)          for(int j=n;j<m;j++)
#define RFROM(n,m)          for(int i=n-1;i>=m;i--)
#define RFROMJ(n,m)         for(int j=n-1;j>=m;j--)
#define STL_FOR(a)          for(auto i=a.begin();i!=a.end();i++)
#define STL_FORJ(a)         for(auto j=a.begin();j!=a.end();j++)
#define STL_FORN(a,x)       for(auto x=a.begin();x!=a.end();x++)
#define STL_FROM(a,n,m)     for(auto i=n;i!=m;i++)
#define STL_FROMJ(n,m)      for(auto j=n;j!=m;j++)
#define RSTL_FOR(a)         for(auto i=a.rbegin();i!=a.rend();i++)
#define RSTL_FORJ(a)        for(auto j=a.rbegin();j!=a.rend();j++)

// Types
#define ll                 long long
#define ull       unsigned long long
#define vec                   vector
#define veci             vector<int>
#define pb                 push_back
#define pf                push_front
#define fi                     first
#define se                    second
#define umap           unordered_map
#define ummap     unordered_multimap
#define mmap                multimap
#define mset                multiset
#define uset           unordered_set
#define umset     unordered_multiset
#define endl                    '\n'
#define sz(a)               a.size()
#define all(a)    a.begin(), a.end()

// I/O
void read() {}
template<typename type, typename... types>
void read(type& arg, types&... args) { cin >> arg; read(args...); }

void write() { cout << endl; }
template<typename type, typename... types>
void write(type arg, types... args) { cout << arg << ' '; write(args...); }

#define dbg(x) cerr<<#x<<" = "<<x<<endl;

template<typename T>
class arr {
private:
	uint32_t n;
	T* a;
public:
	arr(const uint32_t& size) : n(size) {
		a = new T[n];
	}
	~arr() {
		delete[] a;
	}

	inline uint32_t size() {
		return n;
	}
	inline T* data() {
		return a;
	}

	inline T& operator[] (uint32_t indx) {
		return a[indx];
	}

	friend istream& operator>> (istream& in, arr& self) {
		FOR(self.size()) {
			in >> self[i];
		}
		return in;
	}
	friend ostream& operator<< (ostream& out, arr& self) {
		FOR(self.size()) {
			out << self[i] << endl;
		}
		return out;
	}
};

const int M = 2 * 1e5;
int n;
int a[M];

void solve() {
	int x;
	cin >> x;

	int indx = (lower_bound(a, a + n, x) - a);

	int l = indx;
	int r = n - indx - (a[indx] == x);
	
	cout << abs(l - r) + (a[indx] != x) - (r<l)<< endl;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	int t;
	cin >> n >> t;
	FOR(n) cin >> a[i];
	sort(a, a + n);

	FOR(t) solve();
}