#include <bits/stdc++.h>
#define pb push_back

using namespace std;

int n, q, x, l ,r, m;
vector<int> a;

void resi()
{
    cin >> x;
    if(x==m){
        cout << 0 << "\n";
        return;
    }
    else{
        auto p=lower_bound(a.begin(),a.end(),x);
        int p1=p-a.begin();
        if(a[p1]==x){
            l=p1;
            r=n-p1-1;
            if(l>r) cout << abs(l-r)-1 << "\n";
            else cout << abs(l-r) << "\n";
            return;
        }
        else{
            l=p1;
            r=n-p1;
            if(l==r) cout << 1 << "\n";
            else cout << abs(l-r) << "\n";
            return;
        }
    }
}

int main()
{
    cin >> n >> q;
    for(int i=0; i<n; i++){
        cin >> x;
        a.pb(x);
    }
    sort(a.begin(),a.end());
    m=a[n/2];
    while(q--){
        resi();
    }
}