#include <bits/stdc++.h>
#define ll long long
#define MAXN 200020
using namespace std;
ll a[MAXN];
int main()
{
    ios::sync_with_stdio(false); cin.tie(0);
    ll n;
    ll q;
    cin >> n;
    cin >> q;
    for(ll i = 1; i <= n; i++)
        cin >> a[i];
    sort(a + 1, a + 1 + n);
    for(int i = 1; i <= q; i++){
        ll b;
        cin >> b;
        ll levi = lower_bound(a + 1, a + 1 + n, b) - a;
        ll desni = upper_bound(a + 1, a + 1 + n, b) - a;
        desni = desni - 1;
        if(a[levi] == b){
            ll medijana = (n / 2) + 1;
            if(levi <= medijana && medijana <= desni){
                cout << 0 << '\n';
            }
            else if(desni < medijana){
                ll left = desni - 1;
                ll right = n - desni;
                cout << right - left << '\n';
            }
            else{
                ll left = levi - 1;
                ll right = n - levi;
                cout << left - right - 1 << '\n';
            }
        }
        else{
            ll medijana = (n + 1) / 2 + 1;
            if(levi == medijana){
                cout << 1 << '\n';
            }
            else if(levi > medijana){
                ll left = levi - 1;
                ll rigth = n + 1 - levi;
                cout << left - rigth << '\n';
            }
            else{
                ll left = levi - 1;
                ll right = n + 1 - levi;
                cout << right - left + 1 << '\n';
            }
        }
    }
}