#include <bits/stdc++.h>

using namespace std;

#define ll long long
const int INF=1e9;
const ll LINF=1e18,MOD=1e9+7,LOG=17;
const int SQ=317;
#define fi first
#define se second
#define pii pair<int,int>
#define pll pair<long long,long long>
#define mid ((l+r)/2)
#define sz(a) (int((a).size()))
#define all(a) a.begin(),a.end()
#define endl "\n"
#define PRINT(x) cerr<<#x<<'='<<x<<endl;
#define pb push_back
#define PRINTvec(niz) {cerr<<#niz<<"="; for(auto _i:niz) cerr<<_i<<" "; cerr<<endl; }

void Md(ll& x){
    if(x>=MOD) x%=MOD;
}

void Solve(){
    int N,Q; cin>>N>>Q;
    vector<int> a(N+1,-1);
    for(int i=1;i<=N;i++){
        cin>>a[i];
    }
    sort(all(a));
    while(Q--){
        int x; cin>>x;
        if(binary_search(all(a),x)){
            int L=distance(a.begin(),lower_bound(all(a),x));
            int R=distance(a.begin(),prev(upper_bound(all(a),x)));
            int med=(N/2+1);
            if(L<=med && med<=R) cout<<0<<endl;
            else if(R<med) cout<<(N-R)-(R-1)<<endl;
            else cout<<(L-1)-(N-L)-1<<endl;
        }
        else{
            auto ub=upper_bound(all(a),x);
            int br_desno=0,br_levo=0;
            br_levo=distance(a.begin(),prev(ub));
            br_desno=distance(ub,a.end());
            if(br_levo<br_desno) cout<<br_desno-br_levo+1<<endl;
            else cout<<br_levo-br_desno-1+1<<endl;
        }
    }
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t; t=1;
    //cin>>t;;
    while(t--){
        Solve();
    }
    return 0;
}