#include <bits/stdc++.h>

using namespace std;

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

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

    if(x!=a[lower])
    {
        desno=n-lower;
        cout<<desno-lower+1<<"\n";
        return;
    }
    else
        lower=upper_bound(lower+a.begin(),a.end()-n/2,x)-a.begin()-1;

    desno=n-lower-1;
    cout<<desno-lower<<"\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;
}