#include <bits/stdc++.h>
using namespace std;
int n,q,x,poz;
int niz[200007];
int main(){
  cin>>n>>q;
  for(int i=1;i<=n;i++)cin>>niz[i];
  sort(niz+1,niz+n+1);
  while(q--){
     cin>>x;
     int trazena_poz=n/2+1;
     int trenutna_medijana=niz[trazena_poz];
     if(trenutna_medijana==x){cout<<0<<endl;continue;}
     if(x>niz[n]){cout<<n<<endl;continue;}
     int l=1;
     int r=n;
     poz=-1;
     int sredina=(l+r)/2;
     while(l<=r){
       sredina=(l+r)/2;
       if(niz[sredina]>=x){
          r=sredina-1;
          poz=sredina;
       }
       else l=sredina+1;
     }
     if(niz[poz]!=x){
        cout<<abs(trazena_poz-poz)*2+1<<endl;
        continue;
     }
     if(abs(trazena_poz-poz)==1){cout<<1<<endl;continue;}
     cout<<abs(trazena_poz-poz)*2<<endl;
  }



 return 0;
}
/*/
5 10
1 3 5 7 9
1 2 3 4 5 6 7 8 9 0 1 2 3
1 2 3 4 5 6 7 8 8 8 9 10
1 2 3 4 5 6 7 8 9 9 9 9 10



10 10
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 7 7 8 9 10
7 = 2
1 2 3 4 5 6 7 8 8 8 8 8 9 10
8 = 4
1 2 3 4 5 6 7 8 9 9 9 9 9 9 9 10 (16)
1 2 3 4 5 6 7 8 9 10 10 10 10 10 10 10 10 10
9 =

1 1 1 1 1 3 5 7 9

/*/