#include <bits/stdc++.h>

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n, q, b, manji, veci;
	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;
		manji = lower_bound(a.begin(), a.end(), b) - a.begin();
		veci = n - (upper_bound(a.begin(), a.end(), b) - a.begin());
		cout << max(manji * 2, veci * 2 + 1) - n << endl;
	}

}