#include <iostream>
#include <set>
#include <map>
#include <algorithm>
#include <vector>
#include <string>
#include <deque>
#include <queue>
#include <cmath>
#include <iomanip>
#include <utility>
#define pb push_back
#define ll long long
#define yes cout<<"YES"<<endl;
#define no cout<<"NO"<<endl;
using namespace std;
// Milovan > Aleksamaster
// find_by_order-kti element skupa
// order_of_key(k)-broj elemenata striktno manji od k
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//cout<<13/2+1;
	ll n,k;
	cin>>n>>k;
	ll a[n+1];
	map<ll,ll>m;
	// 2 2 2 2 7 4 4 8 10 10 9
	// 11:6=x:5
	// 55=6x
	// x=55/6;
	for(int i=1;i<=n;i++)cin>>a[i],m[a[i]]++;
	sort(a+1,a+n+1);
	ll faken=n;
	while(k--){
		n=faken;
		ll x;
		cin>>x;
		ll gde=lower_bound(a+1,a+n+1,x)-a;
		ll dokle=0;
		dokle=1;
		dokle=upper_bound(a+1,a+n+1,x)-a;
		dokle--;
		if(n/2+1>=gde&&n/2+1<=dokle)cout<<"0";
		else {
				int ans1=0;
				int r=0;
				if(n/2+1>dokle){
						ll ind=dokle;
						if(!m[x])ind++,n++,ans1++;
						int l=0,r=1e9,ans=0;
						while(l<=r){
							int mid=(l+r)/2;
							//cout<<mid<<endl;
							if(ind+mid==(n+mid)/2+1){
								ans=mid;
								r=mid-1;
							}
							if(ind+mid>(n+mid)/2+1)r=mid-1;
							if(ind+mid<(n+mid)/2+1)l=mid+1;
						}
						cout<<ans+ans1;
				}
				else {
						ll ind=gde;
						if(!m[x]&&ind!=n+1)n++,ans1++;
						ll l=0,r=1e9,ans=0;
						while(l<=r){
							ll mid=(l+r)/2;
							if(ind==(n+mid)/2+1){
								ans=mid;
								r=mid-1;
							}
							if(ind>(n+mid)/2+1)l=mid+1;
							else r=mid-1;
						}
						// 12 kad postavim
						// 12/2=6+1=7
						cout<<ans+ans1;
				}
			}
			cout<<endl;
		}
		// 1 7 5 6 5 9 3 5
		// 1 3 5 5 5 6 7 8 9 0 0 0 0 0 0
		// x=8 , n=9
}