#include <bits/stdc++.h>

using namespace std;

void rijesi(vector<int>& a, int &n, int &x)
{
    if(x==a[n/2])
    {
        cout<<"0\n";
        return;
    }
    if(x>a[n-1])
    {
        cout<<n<<"\n";
        return;
    }
    if(x>a[n/2])
    {
        int indeks=lower_bound(a.begin()+n/2, a.end(), x)-a.begin();
        cout<<2*indeks-n<<"\n";
        return;
    }
    int lower=lower_bound(a.begin(),a.end()-n/2,x)-a.begin();
    bool ok=false;

    if(x!=a[lower])
        ok=true;

    if (lower<n-lower)
    {
        cout<<n-2*lower+ok<<"\n";
        return;
    }
    cout<<2*lower-n+ok<<"\n";
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,q;
    cin>>n>>q;
    vector<int> a(n);
    sort(a.begin(), a.end());
    int i;
    for(i=0; i<n; i++)
        cin>>a[i];
    int x;
    while(q--)
    {
        cin>>x;
        rijesi(a,n,x);
    }

    return 0;
}