#include <iostream>
#include <algorithm>
using namespace std;

int main (){

    long long N, Q;
    cin>>N>>Q;
    long long A[N+1]={0};
    long long B[Q+1]={0};
   
    for(long long i=1;i<=N;i++){
    cin>>A[i];
}
for(long long i=1;i<=Q;i++){
    cin>>B[i];
}
sort(A, A+N+1);

long long med = A[N/2+1];
   
   
    for(long long i=1;i<=Q;i++){
    long long br = 1;
    if(B[i]==med){
    cout<<0<<endl;
}
else {

while (A[br]<B[i]){
br++;
}
if (B[i]<med){
cout<<N-2*br+1<<endl;
}
else if (B[i]>med && br<=N){
cout<< 2*br - N - 1<<endl;
}
else{
cout<<N<<endl;
}

 }
}    
}