#include<iostream>
#include<queue>
#include<vector>
#include<iterator>
#include<algorithm>
using namespace std;

int main()
{
	int n, q, x, s;
	long long l, d;
	queue<int> rez;
	cin >> n >> q;
	vector<int>a;
	for (int i = 0; i < n; i++)
	{
		cin >> x;
		a.push_back(x);
	}
	sort(a.begin(), a.end());
	for (int i = 0; i < q; i++)
	{
		cin >> x;
		if (a[n / 2] == x)
		{
			rez.push(0);
			continue;
		}
		l = distance(a.begin(), lower_bound(a.begin(), a.end(), x));
		d = distance(upper_bound(a.begin(), a.end(), x), a.end());
		s = n - d - l;
		if (l == n) {
			rez.push(n);
			continue;
		}
		if (l < d) l = l + s - 1;
		else d = d + s - 1;
		if (l > d) x = l - d - 1;
		else x = d - l;
		rez.push(x);
	}
	while (!rez.empty())
	{
		cout << rez.front() << endl;
		rez.pop();
	}
	return 0;
}