#include <iostream>
#include <algorithm>
using namespace std;
int pm(int n[], int l, int t) {
    int a = 0;
    int g = l;
    while (a < g)
    {
        int k = a + (g - a) / 2;
        if (n[k] >= t)g = k;
        else a = k + 1;
    }
    return g - 1;
}

int main()
{
    int n, q;
    cin >> n >> q;
    int a[200000];
    int b[200000];
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    for (int i = 0; i < q; i++)
    {
        cin >> b[i];
    }
    sort(a, a + n);
    for (int i = 0; i < q; i++)
    {
        int p;
        if (a[pm(a, n, b[i])+1] == a[n / 2])cout << 0 <<endl;
        else if (n % 2 == 1){
            p = (pm(a, n, b[i]) + 1 - n / 2) * 2 - 1;
            cout<<p<<endl;
        }
        else if (n % 2 == 0){
            p = (pm(a, n, b[i]) + 1 - n / 2) * 2;
            cout << p << endl;
        }
    }
}