#include <bits/stdc++.h>
#define ff(i,a,b) for(int (i) = (a); (i) < (b); ++ (i))
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pic pair<int,char>
#define FF(i,a,b) for(int (i) = (a); (i) > (b); -- (i))
#define xx first
#define yy second
#define pb push_back
#define ll long long
#define pqq priority_queue
using namespace std;
long long a[200007];
int binarnaVeci(int l,int r,int target){
	if(target>a[r])return r+1;
	if(target<=a[l])return l;
	if(r-l == 1)return r;
	int mid = (l+r)/2;
	if(a[mid] >= target)return binarnaVeci(l,mid,target);
	return binarnaVeci(mid,r,target);
}
int binarnaManji(int l,int r,int target){
	if(target>=a[r])return r;
	if(target<a[l])return l-1;
	if(r-l == 1)return l;
	int mid = (l+r)/2;
	if(a[mid] <= target)return binarnaManji(mid,r,target);
	return binarnaManji(l,mid,target);
}
void solve(int mediana,int par,int n){
	int trg;cin>>trg;
	int ans = 0;
	if(trg == a[mediana]){
		cout<<ans<<endl;
		return;
	}
	if(trg<a[mediana] && par == 0){
		int idx = binarnaManji(0,n-1,trg);
		ans = (mediana-idx)*2-1;
		cout<<ans<<endl;
		return;
	}
	if(trg<a[mediana] && par == 1){
		int idx = binarnaManji(0,n-1,trg);
		ans = (mediana-idx)*2;
		cout<<ans<<endl;
		return;
	}
	if(trg>a[mediana] && par == 0){
		int idx = binarnaVeci(0,n-1,trg);
		ans = (idx-mediana)*2;
		cout<<ans<<endl;
		return;
	}
	if(trg>a[mediana] && par == 1){
		int idx = binarnaVeci(0,n-1,trg);
		ans = (idx-mediana)*2-1;
		cout<<ans<<endl;
		return;
	}
}
int main(){
	ios::sync_with_stdio(false);
    cin.tie(0);
    int n,q;cin>>n>>q;
	ff(i,0,n){
		cin>>a[i];
	}
	sort(a,a+n);
	int mediana;
	if(n%2 == 0){
		mediana = a[n/2];
	}else{
		mediana = (n-1)/2;
	}
	while(q--)
    solve(mediana,n%2,n);
}