#include<bits/stdc++.h>
using namespace std;
long long n,q,br,br1,br2,br3,s,z,x,k;
int main(){
    cin>>n>>q;
    long long a[n+5],b[q+5];
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    sort(a+1,a+n+1);
    for(int i=1;i<=q;i++){
        cin>>b[i];
        z=n/2+1;
        s=n;
        x=n;
        k=n;
        br=0;
        br1=0;
        br2=0;
        br3=0;
        for(int j=1;j<=n;j++){
            if(a[j]==b[i] and br==0){
                br=j;
                s=abs(z-br);
                if(s==0){
                    break;
                }
            }
            else if(a[j]==b[i] and br!=0){
                br1=j;
                x=abs(z-br1);
                if(x==0){
                    break;
                }
            }
            else if(a[j]>b[i] and br2==0){
                br2=j;
                k=abs(z-br2);
            }
        }
        if(s==n and x==n){
            if(br2==1){
                cout<<n+1<<endl;
                br3++;
            }
            else if(br2==0){
                cout<<n<<endl;
                br3++;
            }
            else if(k==0 and n%2==0){
                cout<<1<<endl;
                br3++;
            }
            else if(k==0 and n%2==1){
                cout<<2<<endl;
                br3++;
            }
            else if(z>br2){
                s=k+1;
                br=br2-1;
            }
            else{
                s=k;
                br=br2;
            }
        }
        if(br3==0){
            if(abs(s)==0 or abs(x)==0){
                cout<<0<<endl;
            }
            else if(x==n){
                if(z>br){
                    cout<<n-2*br+1<<endl;
                }
                else{
                    cout<<2*br-n-2<<endl;
                }
            }
            else if(n%2==1){
                if(abs(s)<abs(x)){
                    cout<<2*br-n-2<<endl;
                }
                else if(abs(s)>abs(x)){
                    cout<<n-2*br1+1<<endl;
                }
            }
            else{
                if(abs(s)<abs(x)){
                    cout<<2*br-n-3<<endl;
                }
                else if(abs(s)>abs(x)){
                    cout<<n-2*br1+1<<endl;
                }
            }
        }
    }
return 0;
}