#include <bits/stdc++.h>
using namespace std;

#define ios ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long
#define ull unsigned long long
#define inf INT_MAX
#define llinf LLONG_MAX
#define mt make_tuple
#define mp make_pair
#define parll pair<ll,ll>
#define parii pair<int,int>
#define frs first
#define sec second
#define neparno(x) (x&1)
#define parno(x) (!neparno(x))
#define lowbit(x) (x&-x)
#define nzd __gcd
#define nzs(e1,e2) (e1/nzd(e1,e2))*e2
#define all(V) V.begin(),V.end()
#define fill(V,v) fill(all(V),v)
#define l_b(BRL,brl) lower_bound( BRL.begin(), BRL.end(), brl )-BRL.begin()-1
#define u_b(BRU,bru) upper_bound( BRU.begin(), BRU.end(), bru )-BRU.begin()
#define mxn 200004

ll n,q,x;
vector <ll> A(mxn);

int main()
{
    ios;

    cin >> n >> q;
    for ( ll i = 1; i <= n; i++ )
    {
        cin >> A[i];
    }
    sort( A.begin()+1, A.begin()+n+1 );

    while ( q-- )
    {
        cin >> x;
        ll t = lower_bound( A.begin()+1, A.begin()+n+1, x )-A.begin()-1;
        ll levo=t,desno=n-t,y=n-t;
        bool dodajemx = !(binary_search( A.begin()+1, A.begin()+n+1, x ));
        while ( t < n && A[t+1] == x && desno > levo )
        {
            t++;
            levo = t-1;
            desno--;
            dodajemx = false;
        }
        desno = (desno==y)?desno-(!dodajemx):desno;
        if ( (neparno(n+dodajemx) && levo == desno) || (parno(n+dodajemx) && levo-1 == desno) )
        {
            cout << dodajemx << "\n";
            continue;
        }
        cout << max(abs(levo-desno)+dodajemx-(levo>=desno),0ll) << "\n";
    }

    return 0;
}