#include<bits/stdc++.h>

using namespace std;


int main(){
    //ios_base::sync_with_stdio(false);
    long long n, q, med, res = 0;
    cin >> n >> q;
    vector<long long>a(n);
    for (long long i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    vector<long long>::iterator dg,gg;
    long long gornja, donja, trmed = a.size()/2;
    for (long long i = 0; i < q; i++)
    {
        cin >> med;
        auto gg = upper_bound(a.begin(), a.end(), med);
        auto dg = lower_bound(a.begin(), a.end(), med);
        gornja = gg-a.begin(); donja = dg - a.begin(); 
        if((donja <= trmed && gornja > trmed) || (donja==trmed && gornja-1==trmed))res = 0;
        else if(donja==a.size() || gornja==0) res = a.size();
        else if(donja<trmed && gornja <= trmed)
            if(a.size()%2 == 0)
                res = (trmed-gornja+1) * 2 - 1;
            else
                res = (trmed-gornja+1) * 2;
        else if(donja>trmed && gornja > trmed)
            if(a.size()%2 == 0) 
                res = (donja-trmed)*2;
            else 
                res = (donja-trmed)*2 - 1;
        cout << res << endl;
    }
    

    return 0;
}