#include <bits/stdc++.h>

using namespace std;

int main()
{
	int n, q, b, c, it1, it2;
	cin >> n >> q;
	vector <int> a(n);
	for (int i = 0; i < n; i++)
		cin >> a[i];
	sort(a.begin(), a.end());
	for (int i = 0; i < q; i++)
	{
		cin >> b;
		it1 = lower_bound(a.begin(), a.end(), b) - a.begin();
		it2 = upper_bound(a.begin(), a.end(), b) - a.begin();
		if (it1 <= n / 2 && it2 > n / 2)
			cout << 0 << endl;
		else if (it1 == n / 2)
			cout << 1 << endl;
		else if (n - it2 > it1)
			cout << 2 * (n - it2) - 1 - n << endl;
		else
			cout << 2 * it1 - n << endl;
	}

}