#include<stdio.h>
#include<math.h>
unsigned long long postoji(unsigned long long a[], unsigned long long n, unsigned long long b);
int main(){
	unsigned long long N,Q,i,j,element,s1;
	scanf("%lld %lld",&N,&Q);
	unsigned long long A[N],B[Q];
	for(i=0;i<N;i++){
		scanf("%lld",&A[i]);
	}
	for(i=0;i<Q;i++){
		scanf("%lld",&B[i]);
	}
	for(i=1;i<N;i++){
 		j=i-1; 
 		element=A[i];  	
		 while(j>=0&&element<A[j]){
 			A[j+1]=A[j]; 
			  			j--; 
		 }
		 A[j+1]=element; 
	 }
	 for(i=0;i<Q;i++){
	s1=postoji(A,N,B[i]);
	if(s1==N/2) printf("%lld\n",0);
	else if(s1<N/2&&s1>=0) printf("%lld\n",abs(N/2-s1)*2+1);
	else if(s1>N/2) printf("%lld\n",abs(N/2-s1)*2-1);
	else{
		if(B[i]>A[N-1]) printf("%lld\n",N);
		else if(B[i]<A[0]) printf("%lld\n",N+1);
		else {
			while(s1==-1){
				B[i]=B[i]+1;
				s1=postoji(A,N,B[i]);
			}
			if(s1<N/2) printf("%lld\n",abs((N+1)/2-s1)*2+2);
	else if(s1>N/2) printf("%lld\n",abs((N+1)/2-s1)*2);
		}
	}
	 }
	return 0;
}
unsigned long long postoji(unsigned long long a[], unsigned long long n, unsigned long long b) {
  unsigned long long l, d, s;
  l = 0; d = n-1;
  while(l <= d) {
    s = (l+d)/2;
    if(b==a[s]) return s;
    	else if (b < a[s]) d = s - 1;
    				else l = s + 1;
  }
  return -1;
}