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


    int main(){
        long long n, q, p, x;
        cin>>n>>q;
        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, med;
    bool b;
    bp=0;
    nt = n; 
    vector<long long>::iterator  t;
    b = binary_search(a.begin(), a.end(), x);
    
    if(b==false){     
        nt++;
        bp++;
        }
    
    
   
    t= lower_bound(a.begin(), a.end(), x);
    p= t-a.begin();
    med = nt/2;
   

    k = abs(p-med);
    if(p<med)cout<<k*2 + (n+1)%2 <<endl;
    else if(p>med) cout<<k*2 - nt%2<<endl;
    else cout<<k*2+bp <<endl;
    



}
        
    }