#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    int n, q;
    cin >> n >> q;
    
    vector<int> a(n);
    vector<int> b(q);
    vector<int> resenje(q);
    
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    for (int i = 0; i < q; i++) {
        cin >> b[i];
    }

    sort(begin(a), end(a));

    for (int i = 0; i < q; i++) {
        
        auto it_manji = lower_bound(begin(a), end(a), b[i]);
        int manji = it_manji - begin(a);
        
        auto it_manjijednaki = upper_bound(begin(a), end(a), b[i]);
        int manje_jednaki = it_manjijednaki - a.begin();
        
        int jednaki = manje_jednaki - manji;
       
        int veci = a.size() - manje_jednaki;

        if (jednaki == 0) {
            if (manji == veci) {
                resenje[i] == 1;
            }
            else if (manji < veci) {
                resenje[i] = veci - manji + 1;
            }
            else if (manji > veci) {
                resenje[i] = manji - veci;
            }
        }
        else {
            if (manji == veci) {
                resenje[i] == 0;
            }
            else if (manji < veci) {
                if (manji + jednaki >= veci + 1) {
                    resenje[i] == 0;
                }
                else {
                    resenje[i] = veci - manji - jednaki + 1;
                }
            }
            else if (manji > veci) {
                if (veci + jednaki >= manji) {
                    resenje[i] = 0;
                }
                else {
                    resenje[i] = manji - veci - jednaki;
                }
            }
        }
    }

    for (int i = 0; i < q; i++)
        cout << resenje[i] << endl;
    
    return 0;
}