#include <bits/stdc++.h>
using namespace std;
int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int N,Q;
    cin >> N >> Q;
    vector <int> A(N);
    vector <int> B(Q);

    for(int i=0;i<N;i++){cin >> A[i];}
    for(int i=0;i<Q;i++){cin >> B[i];}
    sort(A.begin(),A.end());

    for(int i=0; i<Q;i++){
        if(B[i]==A[N/2]){
            cout << "0"<<"\n";
            continue;
        }
        vector<int>::iterator broj=lower_bound(A.begin(), A.end(), B[i]);
        int paran=0,neparan;
        if(N%2==0)paran++;
        else
            neparan++;
        if(B[i]>A[N/2])
            cout << abs( ( (broj - A.begin()) - (N/2)-1) *2 ) + 1 + paran << "\n";
        else
            cout << abs( ( (N/2) - (broj - A.begin())) *2 ) +1 + neparan << "\n";
    }


    return 0;
}