#include<bits/stdc++.h>

using namespace std;

bool is_rat(double x)
{
    int k = x;

    x = x - 0.1;
    double k1 = k;
   // cout << x << " " << k1 << " ";
    double zero = x - k1;
    if (abs(zero - 0) < 0.0001){
        return true;
    }
    return false;
}

double binarySearch(int arr[], int l, int r, int x)
{
    if (x > arr[r - 1]){
        return r;
    }
    if (x < arr[l]){
        return l - 1;
    }
    while (l <= r) {
        int m = l + (r - l) / 2;


        if (arr[m] == x)
            return m + 0.1;
        if(x > arr[m - 1] && x < arr[m]){
            return m;
        }
        if(x > arr[m] && x < arr[m + 1]){
            return m + 1;
        }


        if (arr[m] < x)
            l = m + 1;


        else
            r = m - 1;
    }


    return -1;
}
void resi(int a[200000], int q, int n, int m)
{
    double k = binarySearch(a, 0, n, q);
   // cout << k << " ";

    if (k == -1)
    {
        cout << n ;
        return;
    }
    if (k == n){
        cout << n  ;
        return;
    }
    if (is_rat(k)){
       // cout << k << " ";
        k = k - 0.1;
       // cout << k << " ";
        if (k == m){
            cout << 0 ;
            return;
        }
        else if(k < m){
            if (n % 2 == 0){
                cout << 2 * (m - k)  - 1;
                return;
            }
            else {
                cout << 2 * (m - k)  ;
                return;
            }

        }
        else {
            if (n % 2 == 0){
                cout << 2 * (k - m) - 1;
                return;
            }
            else {
                cout << 2 * (k - m)  - 1;
                return;
            }
        }
    }
    else {
        n = n + 1;
        m = n / 2;
        if (k == m){
            cout << 1 << "\n";
            return;
        }
        else if(k < m){
            if (n % 2 == 0){
                cout << 2 * (m - k)  ;
                return;
            }
            else {
                cout << 2 * (m - k) + 1 ;
                return;
            }

        }
        else {
            if (n % 2 == 0){
                cout << 2 * (k - m)   + 1;
                return;
            }
            else {
                cout << 2 * (k - m)   ;
                return;
            }
        }
    }

}

int main()
{
    int n , q;
    cin >> n >> q;
    int a[2 * 100000];
    int b[2 * 100000];
    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++){

        resi(a, b[i], n, n / 2);
        if (i != q - 1) cout << "\n";
    }
}