#include <bits/stdc++.h>

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	int n, q;
	cin >> n >> q;
	int a[n];
	for(int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a, a + n);
	for(int j = 0; j < q; j++) {
		int u;
		cin >> u;
		int o = lower_bound(a, a + n, u) - a;
		int e = upper_bound(a + o, a + n, u) - a;
		if(u > a[n - 1]) cout << n << "\n";
		else if(a[o] != u) {
			if(o > n/2) cout << 2*o - n <<"\n";
			else cout << -2*o + n + 1 << "\n";
		}
		else {
			if(o > n/2) cout << 2*o - n <<"\n";
			else {
				if(e - 1 >= n/2) cout << 0 << "\n";
				else cout << -2*(e) + n + 1 << "\n";
			}
		}
	}
	return 0;
}