#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int indexBsearch(int a, vector<int>& data, int l, int d){
    while(d-l >= 2){
        int m = (l+d)/2;
        if(data[m] > a) d = m;
        else l = m;
    }
    if(data[l] == a) return l;
    if(data[d] == a) return d;
    return -1;
}

int main()
{
    int n, q;
    cin>>n>>q;
    vector<int> a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    sort(a.begin(), a.end());
    int iM;
    if(n%2)iM= n/2;
    else iM = n/2 +1;
    int m = a[iM];
    int c;
    for(int i=0;i<q;i++){
        cin>>c;
        int index = indexBsearch(c, a, 0, n-1);
        if(m==c)cout<<0<<endl;
        else if(index==-1)cout<<n<<endl;
        else if(iM>index)cout<<n-2*index-1<<endl;
        else cout<<2*index-n<<endl;
    }
    
    return 0;
}