#include <bits/stdc++.h>

#define ll long long

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    ll n, q, b, m;
    cin >> n >> q;
    m = floor((float)n/2) + 1;
    vector<ll> a(n);

    for (ll i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    sort(a.begin(), a.end());

    for (ll i = 0; i < q; i++)
    {
        cin >> b;
        auto p = equal_range(a.begin(), a.end(), b);
        ll start = p.first - a.begin();
        ll end = p.second - a.begin();

        ll nl, nr, nb;
        nl = start;
        nr = n - end;
        nb = end - start;
        if (nl > nr)
            nl--;

        cout << abs(nr - nl) + (1 - nb) << "\n";
    }
}