#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll N,M,r1,r2,rez,gde,dg,gg,jed,skloni,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;
		}
		jed=N-r1-r2;
		if(niz[(N+1)/2]==q){ /// Vec je medijan
			cout<<"0\n";
			continue;
		}
		//cout<<r1<<" "<<r2<<endl;
		skloni=min(r1,r2);
		r1-=skloni;
		r2-=skloni;
		//cout<<r1<<" "<<jed<<" "<<r2<<endl;
		if(r2==0){
			rez=r1-jed-4;
			rez=max(rez,0ll);
			jed+=rez;
			while((jed+r1)/2+1<=r1){ ///Ovo se desi samo 2,3 puta
				jed++;
				rez++;
			}
			if(jed==0)
            rez++;
			cout<<rez<<"\n";
			continue;
		}
		rez=(r2-jed-4);
		rez=max(rez,0ll);
		jed+=rez;
		while((jed+r2)/2+1>jed){
			jed++;
			rez++;
		}
		if(jed==0)
         rez++;
		cout<<rez<<"\n";
	}
	return 0;
}