#include <iostream>
#include <algorithm>

using namespace std;

int binarna(int a[], int n, int b){

    int l, d;

    l = 0;

    d = n - 1;

    int mid;

    while(l <= d){

        mid = (l + d) / 2;

        if(a[mid] == b) return mid;

        else if(a[mid] > b) d = mid - 1;

        else l = mid + 1;
    }

    return -1;

}

int priblizna_binarna(int a[], int n, int b){

    int l, d;

    l = 0;

    d = n - 1;

    int mid;

    while(l <= d){

        mid = (l + d) / 2;

        if(a[mid] < b && a[mid+1] > b) return mid;

        else if(a[mid] > b) d = mid - 1;

        else l = mid + 1;
    }

}

int main()
{
    int n, q;

    cin >> n >> q;

    int a[n], b[q];

    for(int i = 0; i < n; i++) cin >> a[i];

    sort(a, a + n);

    for(int i = 0; i < q; i++) cin >> b[i];

    int res;

    cout << endl;
    
    for(int i = 0; i < q; i++){

        int poz = binarna(a, n, b[i]);

        if(poz != -1){

            res = abs( (n - poz - 1) - poz );

            if(poz > (n - poz - 1)) res --;

        }

        else{

            if(b[i] < a[0]) res = n + 1;

            else if(b[i] > a[n-1]) res = n;

            else{

                poz = priblizna_binarna(a, n, b[i]);

                res = abs( (n - poz - 1) - (poz + 1) ) + 1;

                if((poz + 1) > (n - poz - 1)) res --;

            }

        }

        cout << res << endl;
    }

    return 0;
}