#include<bits/stdc++.h>
using namespace std;

int main(){
	ios::sync_with_stdio(0); cin.tie(0);
	cout.tie(0);
	int N, Q;
	cin >> N >> Q;
	vector<int> a;
	for(int i = 0; i < N; i++){
		int k; cin >> k;
		a.push_back(k);
		}
	sort(a.begin(), a.end());
	vector<int> resenja;
	
	while(Q--){
		int t; cin >> t;
		bool ex = false;
		int sm, vc;
		sm = lower_bound(a.begin(), a.end(), t) - a.begin();
		ex = a[sm] == t;
		int res;
		if(ex){
			int tm = sm;
			while(a[tm] == t){
				tm++;
			}
			vc = N - tm;
			if(sm > vc){
				res = sm - vc - 1;
			}
			else{
				res = abs(sm - vc);
			}
		}
		else{
			vc = N - sm;
			if(sm > vc){
				res = sm - vc - 1;
			}
			else{
				res = abs(sm - vc);
			}
			res++;
		}
		resenja.push_back(res);
	}
	for(int k : resenja){
		cout << k << endl;
	}
	return 0;
}