#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define F first
#define S second
#define all(v) v.begin(), v.end()
#define LPRINT(a, b) for (auto&(a) : (b))
#define li(i,a,b) for (int (i) = (a); (i) < (b); (i)++)
#define lij(i,a,b) for (int (i) = (a); (i) <= (b); (i)++)


int bs(vector<int> a, int target, int n){
	int l = 0, r = n-1;
	int ans = -1;
	while(l<=r){
		int mid = l+(r-l)/2;
		if(a[mid] >= target){
			ans=mid;
			r=mid-1;
		}
		else{
			l = mid+1;
		}
	}
	return ans;	
}


int main()
{
ios_base::sync_with_stdio(false); cin.tie(NULL);
int n,q;
cin>>n>>q;
vector<int> a(n);
vector<int> b(q);
for(int i = 0; i<n; i++){
	cin>>a[i];
}
for(int i = 0; i<q; i++){
	cin>>b[i];
}

sort(all(a));
int m = a[n/2];

for(int i = 0; i<q; i++){

	int tempN = n;
	int res = 0;

	int index = bs(a,b[i],n);
	if(index == -1) index = n;
	

	if(index==n){
		res++;
		tempN++;
	}
	else if(a[index]!=b[i]){
		res++;
		tempN++;
	}

	int d = abs(tempN/2-index);

	if(b[i]==m) cout<<0<<endl;
	else if(b[i]<m){
		if(tempN%2==0){
			cout<<res+d*2-1<<endl;
		}
		else{
			cout<<res+d*2<<endl;
		}
	}
	else{
		if(tempN%2==0){
			cout<<res+d*2<<endl;
		}
		else{
			cout<<res+d*2-1<<endl;
		}
	}
}
return 0;
}