#include <bits/stdc++.h>

using namespace std;

int main(){

    ios_base::sync_with_stdio(0);
    cin.tie(0);

    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 pos = n >> 1;
    while(q--){
        int x;

        cin >> x;

        if(x == a[pos]) { cout << 0 << '\n'; continue; }
        if(x > a[pos]){
            int lo = 0, hi = n-1, tmpPos = n;
            while(lo <= hi){
                int mid = ((lo + hi) >> 1);

                if(a[mid] < x) lo = mid + 1;
                else hi = mid - 1, tmpPos = mid;
            }

            if(n & 1) cout << (abs(tmpPos - pos) << 1) - 1 << '\n';
            else cout << ((tmpPos - pos) << 1) << '\n';

            continue;
        }

        int lo = 0, hi = n-1, tmpPos = -1;
        while(lo <= hi){
            int mid = ((lo + hi) >> 1);

            if(a[mid] > x) hi = mid - 1;
            else lo = mid + 1, tmpPos = mid;
        }

        if(n & 1) cout << ((pos - tmpPos) << 1) << '\n';
        else cout << ((pos - tmpPos) << 1) - 1 << '\n';
    }
    return 0;
}