#include <bits/stdc++.h>
#define MAXN 200010

using namespace std;

typedef long long ll;

int n, q, x, medIndex, med, y;
int a[MAXN];
int b[MAXN];

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin >> n >> q;
    for(int i = 1; i <= n; i++)
    {
        cin >> a[i];
    }
    sort(a + 1, a + 1 + n);
    medIndex = n/2 + 1;
    med = a[medIndex];
    while(q--)
    {
        cin >> x;
        if(x == med)
        {
            cout << 0 << "\n";
        }
        else if(x < med)
        {
            y = upper_bound(a + 1, a + 1 + n, x) - a - 1;
            cout << 2 * (medIndex - y) << "\n";
        }
        else
        {
            y = lower_bound(a + 1, a + 1 + n, x) - a;
            cout << 2 * (y - medIndex) - 1 << "\n";
        }
    }
    return 0;
}