#include <bits/stdc++.h>
using namespace std;

int main(int argc, char**argv){
ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
long long n, q; cin >> n >> q;
long long a[n], b[q];
for ( int i = 0; i < n; i++ ){
    cin >> a[i];
}
for ( int j = 0; j < q; j++ ){
    cin >> b[j];
}
sort(a,a+n);
for ( int j = 0; j < q; j++){
    if ( b[j] == a[n/2] ){
        cout << 0 << endl;
    }
    if ( b[j] < a[n/2] ){
        long long i = 0;
        while ( (i < n/2) && ( b[j] > a[i] ) ){
            i++;
        }
        cout << n - 2*i - 1<< endl;
    }
    if ( b[j] > a[n/2] ){
        long long i = 0;
        if ( b[j] > a[n-1] ){
            cout << n << endl;
        }
        else{
        while ( (a[n-i-1] > b[j]) && ( i < n/2 + 1 ) ){
            i++;
        }
        if ( n%2 ==  1){
            cout << 2*(n/2 - i) - 1 << endl;
        }
        else{
            cout << n - 2*i - 1<< endl;
        }
        }
    }
}

return 0;
}