#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll N,M,r1,r2,dg,gg,sred,q,niz[200005];
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin>>N>>M;
	for(int i=1;i<=N;i++)
		cin>>niz[i];
	sort(niz+1,niz+1+N);
	while(M--){
		cin>>q;
		r1=r2=0;
		dg=1;
		gg=N;
		while(dg<=gg){
			sred=(dg+gg)/2;
			if(niz[sred]<=q){
				r1=sred;
				dg=sred+1;
			}
			else
				gg=sred-1;
		}

		dg=1;
		gg=N;
		while(dg<=gg){
			sred=(dg+gg)/2;
			if(niz[sred]>=q){
				r2=N-sred+1;
				gg=sred-1;
			}
			else
				dg=sred+1;
		}
	//	cout<<r1<<" "<<r2<<endl;
		if(niz[(N+1)/2]==q){
			cout<<"0\n";
			continue;
		}
		if(r1>r2 and (N+r1-r2-1)%2==0)
			cout<<r1-r2-1<<"\n";
		else
			cout<<abs(r2-r1)<<"\n";
	}
	return 0;
}