#include <bits/stdc++.h>
using namespace std;
int a[200100];


int main(){
    int n, q, b;
    cin >> n >> q;
    for(int i=0;i<n;i++){
        cin >>a[i]; 
    }
    sort(a,a+n);
    for(int i=0;i<q;i++){
        cin >> b;
        int l = 0, h = n-1, m, c;
        while(h-l>1){
            m=(h+l)/2;
            if(a[m]<b) l = m+1;
            else h=m;
        }
        int s=n;
        if(a[l]==b) c=l;
        else if(a[h]==b) c=h;
        else{
            c=h;
            s=n+1;
        }
        if(b>a[n-1]) cout << n;
        else if(b<a[0]) cout << n+1;
        else if(c<s/2) cout << s-2*c<<endl;
        else if(c>s/2) cout << s-2*(s-c-1)-1<<endl;
        else cout << 0 << endl;

    }
    return 0;
}