#include <iostream>
#include <bits/stdc++.h>

using namespace std;


int main()
{
    int N,Q;
    cin >> N;
    cin >> Q;
    vector<long long int> A(N);
    vector<long long int> B(Q);
    for (int i = 0;i < N; i++){
        cin >> A[i];
    }
    sort(begin(A),end(A));
    int med = A[N/2];
    for (int i = 0;i < Q; i++){
        cin >> B[i];
        if(B[i] == med){
            cout << 0 << endl;
            continue;
        }
        if(B[i] < A[0]){
            cout << N+1 << endl;
            continue;
        }
        if(B[i] > A[N-1]){
            cout << N << endl;
            continue;
        }
        if(B[i] < med){
            cout << N-1-2*((upper_bound(A.begin(),A.end(),B[i])-A.begin())-1) << endl;
            continue;
        }
        if(B[i] > med){
            cout << 2*(lower_bound(A.begin(),A.end(),B[i])-A.begin()) - N << endl;
            continue;
        }
    }


    return 0;
}