#include <iostream>
#include <iterator>
#include <algorithm>

#define MAXN 200010

using namespace std;

int n, q, a[MAXN], b[MAXN];

int main() {

    cin>>n>>q;
    for (int i=0; i<n; i++) { cin>>a[i]; }
    for (int i=0; i<q; i++)
        cin>>b[i];

    sort(a, a+n);

    for (int i=0; i<q; i++)
    {
        int it=distance(a, lower_bound(a, a+n, b[i]));
        if (it==n)
        {
            cout<<n<<endl;
            continue;
        }
        else
        {
            //cout<<it<<" "<<n-it<<endl;
            if (a[it]==b[i])
            {
                if (it==(n-it) || it==(n-it-1)) cout<<0<<endl;
                else
                {
                    if (it<(n-it)) cout<<n-2*it-1<<endl;
                    else cout<<2*it-n<<endl;
                }
                continue;
            }
            else
            {
                if (it==(n-it)) { cout<<1<<endl; }
                else if (it<(n-it)) { cout<<n-2*it+1<<endl; }
                else { cout<<2*it-n<<endl; }
            }
        }
    }
}