#include <bits/stdc++.h>

using namespace std; 

int main () {
    
    
    ios_base::sync_with_stdio(false);
    cin.tie(0); 
    cout.tie(0); 
    
    int n, q; 
    
    cin>>n>>q; 
    
    int a[n]; 
    
    for(int i = 0 ; i < n ; i++) {
        
        cin>>a[i]; 
        
    }
    
    sort(a, a + n); 
    
    int b[q]; 
    
    for(int i = 0 ; i < q ; i++) {
        
        cin>>b[i]; 
        
        int lb = lower_bound(a, a + n, b[i]) - a; 
        
        if(a[lb] != b[i]) {
            
            if(b[i] < a[0]) { 
                cout<<n+1<<"\n"; 
                continue;
            }
            if(b[i] > a[n-1]) {
                cout<<n<<"\n";
                continue; 
            }
            
            int ub = upper_bound(a, a + n, b[i]) - a; 
            ub++; 
    
            int t_med = (n/2)+1; 
            
            if(t_med < ub) {
                
                cout<<abs((ub-1)-((n+1)-ub))<<"\n";
                
                continue; 
                
            }
            
            cout<<(abs((ub-1)-((n+1)-ub)))+1<<"\n";
            
            continue; 
            
        }
        
        int ub = upper_bound(a, a + n, b[i]) - a; 
        if(ub - 1 == b[i]) { ub--; }
        
        int t_med = n/2; 
        
        int r_lb = abs(lb-(n-lb)); 
        int r_up = abs(ub-(n-ub)); 
    
        if(t_med < lb) {
            
            r_lb = r_lb + (r_lb%2 - 1); 
            
            cout<<r_lb<<"\n"; 
        
            continue;
        
        }
    
        if(t_med > ub) { 
            
            cout<<r_up<<"\n"; 
        
            continue;
            
        }
        
        cout<<0<<"\n"; 
        
    }
    
    return 0; 
    
}