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

int main(){
    int n,q;
    int br;
    int b;
    int j;
    int dn;
    int s,l,d;
    
    cin >> n >> q;
    
    int a[n];
    for (int i=0;i<n;i++){cin>>a[i];}
    sort(a, a + n);
    for (int i=0;i<q;i++){
    	l=0;
    	d=n-1;
        cin>>b;
        if (b>a[n-1]) {dn=n;}
        else{
            while (l<=d){
                s=l+(d-l)/2;
                if (a[s]<b) {l=s+1;}
                else{
                    j=s;
                    d=s-1;
                }
            }
            
            
            if (j==n/2) {dn=0;}
            else {
            	if (j>n/2) {dn=2*j-n;}
            	else {dn=n-1-2*j;}
            }
        }
        cout << dn << "\n";
    }
    return 0;

}