#include <bits/stdc++.h>

using namespace std; 

long long binarna(long long arr[], long long l, long long r, long long x)
{
    if (r >= l) {
        
        int mid = l + (r - l) / 2;

        if (arr[mid] == x) { return mid; }

        if (arr[mid] > x) { return binarna(arr, l, mid - 1, x); }
        
        return binarna(arr, mid + 1, r, x);
        
    }

    return -1;
}

int main () {
    
    
    ios_base::sync_with_stdio(false);
    cin.tie(0); 
    cout.tie(0); 
    
    long long n, q; 
    
    cin>>n>>q; 
    n++;
    
    long long a[n]; 
    
    for(int i = 1 ; i < n ; i++) {
        
        cin>>a[i]; 
        
    }
    
    sort(a, a + n); 
    
    long long b[q]; 
    
    for(int i = 0 ; i < q ; i++) {
        
        cin>>b[i]; 
        
        long long index = binarna(a, 0, n, b[i]); 
        index++; 
    
        if(index == 0) {
        
            if(b[i] < a[1]) { 
            
                cout<<abs((index-1)-((n-1)-index))<<"\n"; 
            
                continue;
           
            }
        
            long long med = abs((index-1)-((n-1)-index)); 
        
            if(med%2==0) {
            
                med--;
            
                cout<<med<<"\n"; 
            
                continue;
            
            }
        
            cout<<med<<"\n"; 
        
            continue;
        
        }
    
        long long t_med = ((n-1)/2)+1; 
    
        long long med = abs((index-1)-((n-1)-index)); 
    
        if(t_med > index) {
        
            cout<<med<<"\n"; 
        
            continue;
        
        }
    
        if(med%2==0 && med != 0) {
        
            med--; 
        
            cout<<med<<"\n"; 
        
            continue;
        
        }
    
        cout<<med<<"\n";
        
    }
    
    return 0; 
    
}