#include <iostream>

using namespace std;

void unos(int a[], int n) {
    for (int i = 0; i < n; i++)
        cin >> a[i];
}
int tackaPreseka(int a[], int n, int x) {
    int s, l = 0, d = n - 1;
    while (l <= d) {
        s = l + (d - l) / 2;
        if (a[s] >= x)
            d = s - 1;
        else
            l = s + 1;
    }
    return l;
}
int compare(const void* a, const void* b)
{
    return (*(int*)a - *(int*)b);
}
int main()
{
    int q, n,indexTr,brList;
    int A[20000],B[20000];
    cin >> n >> q;

    unos(A, n);
    unos(B, q);

    qsort(A, n, sizeof(int),compare);

    for (int i = 0; i < q; i++)
    {
        brList = 0;
        indexTr=tackaPreseka(A,n,B[i]);
        if(A[indexTr]!=B[i])
            ++brList;
        ++indexTr;
        if(indexTr==(n+brList)/2 + 1)
        {
            cout << brList << endl;
        }
        else
        {
            brList += abs(2 * indexTr - (n+brList) - 2);
            cout << brList << endl;
        }
    }
    


    return 0;
}