#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;

int bin(int x[],int n,int a){
    int l=0,d=n-1,s;
    while(l<=d){
        s=(l+d)/2;
        if(x[s]==a) return s;
        else if(x[s]<a) l=s+1;
        else d=s-1;
    }
    return s;
}

int main(){
    int n,q,s,x[3],ad;
    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];
    sort(a,a+n);
    for(int i=0;i<q;i++){
        ad=0;
        if(a[n/2]==b[i]) cout<<0<<endl;
        else if(b[i]<a[0] && b[i]>a[n-1]) cout<<n+1<<endl;
        else{
            s=bin(a,n,b[i]);
            if(a[s]<b[i]){
                x[0]=s+1;
                x[1]=0;
                x[2]=n-s-1;
            }
            else if(a[s]>b[i]){
                x[0]=s;
                x[1]=0;
                x[2]=n-s;
            }
            else{
                x[0]=s;
                x[1]=1;
                x[2]=n-s-1;
            }
            if(x[2]>=x[1]+x[0]) ad=1;
            cout<<abs(abs(x[0]-x[2])-x[1])+ad<<endl;
        }
    }
}