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


    int main(){
        ios_base::sync_with_stdio(false);
        cin.tie(NULL); 
        long long n, q, p, x, med;
        cin>>n>>q;
        med = n/2;
        vector<long long> a;
        for (long long i =0 ; i<n; i++){
            cin>>p;
            a.push_back(p);
        }
        sort(a.begin(), a.end());
for(long long w =0; w<q; w++){
    
    cin>>x;
    
    long long nt, k, bp;
    bool b;
    bp=0;
    nt = n; 
    vector<long long>::iterator  t;
    b = binary_search(a.begin(), a.end(), x);
    t= lower_bound(a.begin(), a.end(), x);
    p= t-a.begin();
    if(b==false){     
        nt++;
        bp++;
        
        }
    med = nt/2;
    
   
    
   
    
   
    k = abs(p-med);
   if(n%2==1){ 
    if(p==med) cout<<bp<<endl;
    else if(p<med)cout<<k*2  <<endl;
    else  cout<<k*2 - 1 + 2*bp<<endl;}

    else{
    if(p==med) cout<<bp<<endl;
    else if(p>med)cout<<k*2 <<endl;
    else  cout<<k*2 -1 + 2*bp<<endl;

    }
    



}
        
    }