#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main(int argc, char *argv[])
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    map<ll,bool>imam;
    ll n,q;
    cin >> n >> q;
    vector<ll>V(n);
    for(ll i=0;i<n;i++)
    {
        cin >> V[i];
        imam[V[i]]=1;
    }
    sort(V.begin(),V.end());
    while(q--)
    {
        ll x,l=0,r=n-1,ans=-1;
        cin >> x;
        if(V[n/2]==x)
        {
            cout << 0 << endl;
            continue;
        }
        while(l<=r)
        {
            ll mid=(l+r)/2;
            if(V[mid]<x)
            {
                ans=mid;
                l=mid+1;
            }
            else r=mid-1;
        }
        ans++;
        ll y=n-ans;
        if(imam[x]==0) y++;
        if(y>ans)
        {
            cout << y-ans << endl;
            continue;
        }
        ll treba=ans+1-y;
        if((ans+y)%2) treba--;
        cout << treba << endl;
    }
}