#include <bits/stdc++.h>

using namespace std;

int main() {

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

    int n, q;
    cin >> n >> q;

    int arr[n];
    for(int i = 0; i < n; i++)
        cin >> arr[i];
    sort(arr, arr + n);

    while(q--) {
        int b;
        cin >> b;

        int index1 = lower_bound(arr, arr + n, b) - arr, index2 = upper_bound(arr, arr + n, b) - arr;
        int bre = index2 - index1, brl = index1, brg = n - bre - brl;
        int ans = (bre == 0);
        if(!bre)
            bre = 1;
        if(brl == brg || brl == brg + 1) {
            cout << ans << endl;
            continue;
        }

        if(brl < brg)
            cout << ans + max(brg - brl - bre + 1, 0) << endl;
        else if(brg < brl)
            cout << ans + max(brl - brg - bre, 0) << endl;
    }
    return 0;
}