#include <bits/stdc++.h>

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n, q, manji, veci;
	cin >> n >> q;
	vector <int> a(n), b(q), c(q);
	for (int i = 0; i < n; i++)
		cin >> a[i];
	for (int i = 0; i < q; i++)
		cin >> b[i];
	sort(a.begin(), a.end());
	for (int i = 0; i < q; i++)
	{
		manji = lower_bound(a.begin(), a.end(), b[i]) - a.begin();
		veci = n - (upper_bound(a.begin(), a.end(), b[i]) - a.begin());
		c[i] = max(manji * 2, veci * 2 + 1) - n;
	}
	for (int i = 0; i < q; i++)
		cout << c[i] << endl;
}