#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 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));
sort(all(b));

int m = a[n/2];
int j = 0;

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


	while(j<n && b[i]>a[j]){
		j++;
	}
	if(b[i]>a[n-1]) j = n;

	int tempN = n;
	int res = 0;

	int index = j;

	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;
}