#include <bits/stdc++.h>
#define ll long long
#define INF 2000000010

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    ll N, Q, M;
    cin >> N >> Q;
    vector <ll> A(N);
    for(ll i = 0; i < N; i++) cin >> A[i];
    sort(A.begin(), A.end());
    while(Q--)
    {
        cin >> M;
        ll rez = 0;
        ll manje = lower_bound(A.begin(), A.end(), M) - A.begin();
        ll vise = N - (upper_bound(A.begin(), A.end(), M) - A.begin());
        ll jednako = upper_bound(A.begin(), A.end(), M) - lower_bound(A.begin(), A.end(), M);
        ///cerr << "REZ:  ";
        if(manje == N) cout << N << endl;
        else if(vise == N) cout << N+1 << endl;
        else
        {
            if(jednako == 1)
            {
                if(manje > vise) cout << manje - vise - 1 << endl;
                else if(vise >= manje) cout << vise - manje << endl;
            }
            else
            {
                if(vise > manje)
                {
                    ll preostaje = vise - manje;
                    preostaje -= jednako - 1;
                    cout << max(0, preostaje) << endl;
                }
                else if(manje > vise)
                {
                    ll preostaje = manje - 1 - vise;
                    preostaje -= jednako - 1;
                    cout << max(0, preostaje) << endl;
                }
                else cout << 0 << endl;
            }
        }
    }
    return 0;
}
/**
4 3
3 4 5 6
4
5
7
**/