#include<bits/stdc++.h>
#define LIMIT 10000000
using namespace std;
int N,Q,A[200005],B[200005],a,b,c,l,r,m,pok1,pok2,sol;
char buffer[LIMIT], *POS;
bool kraj;
inline int getint() { /// samo pozitivni
  char cc;
  while ((cc=*POS++)<'0');
  unsigned long long num = cc - '0';
  while ((cc=*POS++)>='0') num = num * 10 + cc - '0';
  return num;
}
int main(){
  //freopen("B.in","r",stdin);
  fread(buffer, 1, LIMIT, stdin);
  POS=buffer;
  N=getint();
  Q=getint();
  for(int i=1; i<=N; i++)A[i]=getint();
  for(int i=1; i<=Q; i++)B[i]=getint();
  sort(A+1,A+1+N);
  for(int i=1; i<=Q; i++){
    l=1;
    r=N;
    while(l<=r){
      m=(l+r)/2;
      if(A[m]>=B[i])r=m-1;
      else l=m+1;
    }
    pok1=r;
    l=1;
    r=N;
    while(l<=r){
      m=(l+r)/2;
      if(A[m]>B[i])r=m-1;
      else l=m+1;
    }
    pok2=l;
    a=pok1;
    c=N-pok2+1;
    b=N-a-c;
    if(b==0){
      if(a==c)sol=1;
      if(a<c)sol=c-a+1;
      if(a>c)sol=a-c;
    }
    if(b!=0){
      sol=0;
      if(a+b<=c)sol=c-(a+b)+1;
      if(a>=c+b)sol=a-(c+b);
    }
    printf("%d\n",sol);
  }
  return 0;
}