#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, q;
    cin >> n >> q;

    vector<int> a;
    int x, b;

    for(int i=0; i < n; i++)
    {
        cin >> x;
        a.push_back(x);
    }

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

    if(n % 2 == 0)
    {
        for(int i=0; i < q; i++)
        {
            cin >> b;

            vector<int>::iterator l = lower_bound(a.begin(), a.end(), b);
            vector<int>::iterator d = upper_bound(a.begin(), a.end(), b);
            int desno = d - a.begin();
            int levo = l - a.begin();

            desno = a.size() - desno;

            //cout << levo << " " << desno << endl;

            if(levo <= n/2 && desno <= n/2 - 1)
            {
                cout << 0 << endl;
            }
            else if(levo <= n/2)
            {
                cout << desno - (a.size() - desno - 1) << endl;
            }
            else
            {
                cout << 2 * levo - a.size() << endl;
            }
        }
    }
    else
    {
        for(int i=0; i < q; i++)
        {
            cin >> b;

            vector<int>::iterator l = lower_bound(a.begin(), a.end(), b);
            vector<int>::iterator d = upper_bound(a.begin(), a.end(), b);
            int desno = d - a.begin();
            int levo = l - a.begin();

            desno = a.size() - desno;

            //cout << levo << " " << desno << endl;

            if(levo <= (n-1)/2 && desno <= (n-1)/2)
            {
                cout << 0 << endl;
            }
            else if(levo <= (n-1)/2)
            {
                cout << desno - (a.size() - desno - 1) << endl;
            }
            else
            {
                cout << 2 * levo - a.size() << endl;
            }
        }
    }


    return 0;
}