#include<bits/stdc++.h>

using namespace std;

int main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

    int n, q, glas, index, hold, res;

    cin >> n >> q;
    hold = n % 2;

    int glasovi[n];
    sort(glasovi, glasovi + n);

    for(int i = 0; i < n; i++) cin >> glasovi[i];

    while(q--){
        cin >> glas;
        if(glasovi[n / 2] == glas) cout << 0 << "\n";
        else if(glasovi[n / 2] < glas){

            index = lower_bound(glasovi, glasovi + n, glas) - glasovi;
            res = hold + (index - n / 2 - hold) * 2;
            cout << res << "\n";
        }
        else{
            index = upper_bound(glasovi, glasovi + n, glas) - glasovi;
            res = (n / 2 - index + hold) * 2 - hold;
            cout << res << "\n";
        }
    }


    return 0;
}