#include <bits/stdc++.h>

using namespace std;

vector<int> a;
int n,x,q;

void rijesi()
{
    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);

    cin>>n>>q;

    for(int i=0; i<n; i++)
    {
        cin>>x;
        a.push_back(x);
    }
    sort(a.begin(), a.end());
    while(q--)
    {
        cin>>x;
        rijesi();
    }

    return 0;
}