#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char** argv) {
	long long n,x,q,i;
	vector<long long> v;
	vector<long long>::iterator it;
	cin>>n>>q;
	for(i=0;i<n;i++){
		cin>>x;
		v.push_back(x);
	}
	sort(v.begin(),v.end());
	long long l,d;
	for(i=0;i<q;i++){
		cin>>x;
		if(x<v[0]){
			cout<<n+1<<endl;
		}
		else if(x>v[n-1]){
			cout<<n<<endl;
		}
		else{
			if(v[n/2] == x){
				cout<<0<<endl;
			}
			else{
				if(v[(n/2)]<x){
					it=lower_bound(v.begin(),v.end(), x);
				}
				else{
					it=upper_bound(v.begin(),v.end(), x);
					it--;
					if(*it!=x){
						it++;
					}
				}
				if(*it==x){
					l=(it-v.begin());
					d=n-l-1;
					if(l<d){
						cout<<(d-l)<<endl;
					}
					else if(l>d){
						cout<<(l-d-1)<<endl;
					}
					else{
						cout<<0<<endl;
					}
				}
				else{
					l=(it-v.begin());
					d=n-l;
					if(l<d){
						cout<<d-l+1<<endl;
					}
					else if(l>d){
						cout<<l-d<<endl;
					}
					else{
						cout<<0<<endl;
					}
				}
			} 
		}
	}
	return 0;
}