#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 - index % 2) * 2 + (index % 2) + 1;
            cout << res << "\n";
            //cout << n / 2 + index << " " << index << " ";
            //cout << index << "\n";
        }
        else{
            index = lower_bound(glasovi, glasovi + n, glas) - glasovi;
            //cout << abs((n + index) / 2 - index) << "\n";
            cout << n / 2 + index << " " << index << " ";
            cout << index << "\n";
        }
    }


    cout << "\n";
    return 0;
}