#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n, q, x, median, medianI;
    vector<int> a;
    cin >> n >> q;
    for (int i = 0; i < n; i++)
    {
        cin >> x;
        a.push_back(x);
    }
    sort(a.begin(), a.end());
    medianI = n / 2;
    median = a[medianI];
    for (int i = 0; i < q; i++)
    {
        cin >> x;
        if (median == x)
        {
            cout << 0;
        }
        else if (!binary_search(a.begin(), a.end(), median))
        {
            cout << n;
        }
        else
        {
            if (x > median)
            {
                x = (int)(lower_bound(a.begin(), a.end(), x) - a.begin()) - medianI;
            }
            else
            {
                x = medianI - (int)(lower_bound(a.begin(), a.end(), x) - a.begin());
            }
            cout << 2 * x - n % 2;
        }
        cout << "\n";
    }
}