#include <bits/stdc++.h>
using namespace std;
long long niz[200010];
int main(){
	long long n, q;
	scanf("%lld %lld", &n, &q);
	for(int i = 1; i <= n; i++)
		scanf("%lld", &niz[i]);
	sort(niz + 1, niz + n + 1);
	long long trmed = n / 2 + 1;
	vector<long long> v(niz + 1, niz + n + 1);
	while(q--){
		long long x;
		scanf("%lld", &x);
		if(x > niz[n])
			printf("%lld\n", n);
		else if(x < niz[0])
			printf("%lld\n", n + 1);
		else if(x == niz[trmed])
			printf("0\n");
		else{
			// postoje lower i upper bound
			auto lower = lower_bound(v.begin(), v.end(), x);
			auto upper = upper_bound(v.begin(), v.end(), x);
			long long rezlower = lower - v.begin() + 1;
			long long rezupper = upper - v.begin() + 1;
			//cout << rezlower << " " << rezupper << endl;
			long long kolikoLevo = rezlower - 1;
			long long kolikoDesno = n - rezupper + 1;
			//cout << kolikoLevo << " " << kolikoDesno << endl << endl;
			if(kolikoDesno == kolikoLevo){
				if(binary_search(v.begin(), v.end(), x))
					printf("0\n");
				else{
					if(n % 2 == 0){
						printf("1\n");
					}
				}
			}
			else if(kolikoDesno > kolikoLevo){
				printf("%lld\n", kolikoDesno - kolikoLevo + 1 - (rezupper - rezlower));
			}
			else
				printf("%lld\n", kolikoLevo - kolikoDesno - (rezupper - rezlower));
		}
	}
	return 0;
}