#include<iostream>
#include<algorithm>
using namespace std;
int slay(int i, int n){
        int l=i;
        int d=n-i-1;
        if(l==d+1) return 0;
        else if(l==d) return 0;
        else if(l>d) return l-d-1;
        else return d-l;
}
int medijana(int a[],int n, int b){
    sort(a,a+n);
    int i=lower_bound(a,a+n,b)-a;
    if(a[i]==b){
        while(a[i+1]==a[i]&&i<=n/2) i++;
        if(a[i-1]==a[i]&&i==n/2+1)i--;
        slay(i,n);
    }
    else if(b>a[n-1]) return n;
    else if(b<a[0]) return n+1;
    else{
        if(i<n/2+1){
            while(a[i+1]==a[i]&&i<=n/2) i++;
            if(a[i-1]==a[i]&&i==n/2+1)i--;
            slay(i,n);
        }
        else{
            i=upper_bound(a,a+n,b)-a;
            slay(i,n);
        }
    }
}
int main(){
    int n,q;
    cin>>n>>q;
    int a[n],b[q];
    for(int i=0;i<n;i++)
        cin>>a[i];
    for(int i=0;i<q;i++)
        cin>>b[i];
    for(int i=0;i<q;i++)
        cout<<medijana(a,n,b[i])<<endl;
}