#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    int n,q,x,o,i;
    cin>>n>>q;
    vector<int> a (n);
    for (i = 0; i<n; i++)
        cin>>a[i];
    sort(a.begin(), a.end());
    x = n / 2;
    for (i = 0; i < q; i++)
    {
        cin>>o;
        int u = upper_bound(a.begin(), a.end(), o) - a.begin();
        int l = lower_bound(a.begin(), a.end(), o) - a.begin();
        if (l <= x && u > x)
        {
            cout<<0<<endl;
            continue;
        }
        else if (l > x)
        {
            cout<<(l + l - n)<<endl;
            continue;
        }
        else if (u <= x)
        {
            cout<<(n - u - u + 1)<<endl;
            continue;
        }
    }

    return 0;
}