#include<stdio.h>
#include<math.h>
void qbs(long long f,long long l,long long int x[]);
int main(){
	long long int n,q;
	int pr=1,pr1=1;
	scanf("%lld %lld",&n,&q);
	long long int a[n],b[q];
	for(long long int i=0;i<n;i++){
		scanf("%lld",&a[i]);
	}
	for(long long int i=0;i<q;i++){
		scanf("%lld",&b[i]);
	}
	long long int k1,k2,k3;
	long long int res[q];
	
	qbs(0,n-1,a);
		for(long long int i=0;i<q;i++){
			if(a[n/2]==b[i]&&n%2!=0){
				res[i]=0;
				continue;
			}
			else if((a[n/2]+a[n/2-1])/2+1==b[i]&&n%2==0){
				res[i]=0;
				continue;
			}
			else{
				for(long long int j=n/2;j<n;j++){
					if(a[j]==b[i]){
						k1=j-(n-1-j);
					}
					if(j==n-1)pr1=0;
					
				}
				if(pr1==0)k1=n*2;
				for(long long int j=n/2;j<n-1;j++){
					if((a[j]+a[j+1])/2+1==b[i]){
						k2=j-(n-2-j);
						break;
					}
					if(j==n-2)pr=0;
					
				}
				if(pr==0){
					long long int min=a[n/2],poz=n/2;
					for(long long int j=n/2;j<n-1;j++){
					if(abs(b[i]-a[j])<min){
						min=abs(b[i]-a[j]);
						poz=j;
					}
					
					
				}
				
					k2=poz-(n-2-poz);
				}
				
			
				if(a[n-1]>=b[i]){
				if(k1<k2)res[i]=k1;
				else if(k1>k2)res[i]=k2;
				else res[i]=k1;
				
				}
				else {
				k3=n;
				if(k3<res[i])res[i]=k3;
				}
			}
			
			}
		
	
	for(long long int i=0;i<q;i++){
		printf("%lld",res[i]);
		if(i!=n-1)printf("\n");
	}
	
}







void qbs(long long f,long long l,long long int x[]){
	long long int lev,des;
	long long int vi;
	long long int pom;
	if(f<l){
	lev=f;
	des=l;
	vi=f;
	while(lev<des){
		while(x[lev]<=x[vi] && lev<l) lev++;
            while(x[des]>x[vi]) des--;
            if(lev<des){
				pom = x[lev];
                x[lev] = x[des];
                x[des] = pom;

            }
	}
		pom = x[des];
        x[des] = x[vi];
        x[vi] = pom;
        qbs(des+1, l, x);
        qbs(f, des-1, x);
	
	
	}
	
	
}