#include <iostream>
#include <algorithm>

using namespace std;

const int MaxN = 200000;
int a[MaxN];
int b[MaxN];

int nadjiLevi(int x, int l, int r)
{
    int m = (l + r + 1) / 2;
    if (a[m - 1] < x && x <= a[m])
        return m;
    else if (x <= a[m - 1])
        return nadjiLevi(x, l, m - 1);
    else
        return nadjiLevi(x, m, r);
}

int nadjiDesni(int x, int l, int r)
{
    int m = (l + r) / 2;
    if (a[m] <= x && x < a[m + 1])
        return m;
    else if (x < a[m])
        return nadjiDesni(x, l, m);
    else
        return nadjiDesni(x, m + 1, r);
}

int main()
{
    int n;
    int q;
    cin >> n >> q;
    a[0] = -1;
    for (int i = 1; i <= n; i++)
        cin >> a[i];
    a[n + 1] = 1000000001;
    for (int i = 0; i < q; i++)
        cin >> b[i];
    sort(a, a + n + 1);
    for (int i = 0; i < q; i++)
    {
        int l = nadjiLevi(b[i], 0, n + 1), r = nadjiDesni(b[i], 0, n + 1);
        int x;
        if (l > r)
        {
            x = 1;
            if (l < (n + 1) / 2 + 1)
                x += (n + 1 - 2 * l + 1);
            else if (l > (n + 1) / 2 + 1)
                x += (2 * l - (n + 1) - 2);
        }
        else
        {
            x = 0;
            if (r < n / 2 + 1)
                x += n - 2 * r + 1;
            else if (l > n / 2 + 1)
                x += 2 * l - n - 2;
        }
        cout << x << endl;
    }
    return 0;
}