#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, q, p;
    cin >> n >> q;
    int a[n], b[q];
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    for(int i = 0; i < q; i++){
        cin >> b[i];
    }

    int h = n / 2;
    sort(a, a + n);

    for(int i = 0; i < q; i++){
        if(b[i] < a[0]){
            cout << n + 1 << endl;
        }
        else if(b[i] > a[n-1]){
            cout << n << endl;
        }
        else if(a[h] == b[i]){
            cout << 0 << endl;
        }
        else if(a[h] > b[i]){
            p = 0;
            for(int j = 0; j <= h; j++){
                if(a[j] > b[i]){
                    p = j;
                    break;
                }
            }
            if(n % 2 == 0){
                cout << (h - p - 1) * 2 - 1 << endl;
            }
            else{
                cout << (h - p - 1) * 2 << endl;
            }
        }
        else{
            p = 0;
            for(int j = n-1; j >= h; j--){
                if(a[j] < b[i]){
                    p = j;
                    break;
                }
            }
            if(n % 2 == 1){
                cout << (p + 1 - h) * 2 - 1 << endl;
            }
            else{
                cout << (p + 1 - h) * 2 << endl;
            }
        }

    }

    return 0;
}