#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n, q, x, median, medianI, dist, index;
    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 (x < median)
            {
                index = (upper_bound(a.begin(), a.end(), x) - 1) - a.begin();
                dist = medianI - index;
                (n % 2 == 0) ? cout << dist * 2 - 1 : cout << dist * 2;
            }
            else
            {
                index = lower_bound(a.begin(), a.end(), x) - a.begin();
                dist = index - medianI;
                cout << dist * 2 - n % 2;
            }
        }
        cout << "\n";
    }
}