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

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, q, x, arr[200001];
    cin >> n >> q;
    for (int i=0; i<n; i++)
        cin >> arr[i];
    sort(arr, arr+n);
    int med = (n/2);
    for (int i=0; i<q; i++)
    {
        cin >> x;
        if (binary_search(arr, arr+n, x))
        {
            int ix = distance(arr, find(arr, arr + n, x));
            if (ix == med)
                cout << 0 << "\n";
            else if (ix > med)
                cout << 2*ix - n << "\n";
            else
                cout << n - 1 - 2*ix << "\n";
        }
        else
        {
            if (x>arr[n-1])
                cout << n << "\n";
            else if (x<arr[0])
                cout << n+1 <<"\n";
            else
            {
                int index = distance(arr, upper_bound(arr, arr + n, x));
                if (index>med)
                    cout << abs(2*index - n) << "\n";
                else
                    cout << abs(2*index - n) + 1 << "\n";
            }
        }
    }
    return 0;
}