#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;
        if(brl == brg || brl == brg + 1) {
            cout << 0 << endl;
            continue;
        }

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