#include <bits/stdc++.h>
using namespace std;
long long n,q,a[200005],b[200005],medi,mid,low,high,br,mesto,target,bristih;
int findClosestl(int n,int target)
{
    int i1 = n/2+1, j1 = n, mid = 0;
    while (i1 < j1) {
        mid = (i1 + j1) / 2;

        if (a[mid] == target){
                br++;
            return mid;
        }

        if (target < a[mid]) {


            if (mid > 0 && target > a[mid - 1] and target < a[mid]){
                //  cout<<"aaa "<<endl;
                return mid;
            }

            j1 = mid;
        }

        else {
            if (mid < n - 1 && target < a[mid + 1] and target > a[mid]){
                 // cout<<"bbb"<<endl;
                return mid+1;}

            i1 = mid + 1;
        }
    }

    return mid+1;
}
int findClosestr(int n,int target)
{
    int i1 = 1, j1 = n/2+1, mid = 0;
    while (i1 < j1) {
        mid = (i1 + j1) / 2;

        if (a[mid] == target){
            br++;
            return mid;
        }

        if (target < a[mid]) {


            if (mid > 0 && target > a[mid - 1] and target < a[mid]){
                  //cout<<"aaaa"<<endl;
                return mid;
            }

            j1 = mid;
        }

        else {
            if (mid < n - 1 && target < a[mid + 1] and target>a[mid]){
                //  cout<<"bbbb"<<endl;
                return mid+1;
            }
            i1 = mid + 1;
        }
    }

    return mid;
}

int main(){
cin>>n>>q;
for(int i=1;i<=n;i++){
   scanf("%lld",&a[i]);
}
sort(a+1,a+1+n);
if(n%2==0)medi=a[n/2+1];
   else medi=a[(n-1)/2+1];
for(int i=1;i<=q;i++){
   scanf("%lld",&b[i]);
   br=0;
   bristih=0;
   if(b[i]==medi){
      printf("0\n");
   }
   else if(b[i]>a[n]){
      printf("%lld\n",n);
   }
      else if(b[i]<a[1]){
         printf("%lld\n",n+1);
      }
        else if(b[i]>medi and b[i]<a[n]){
                mesto=findClosestl(n,b[i]);
               // cout<<mesto<<" bbfbfb "<<endl;
                if(n%2==1){
                  if(br==0)printf("%lld\n",(mesto-(n/2+1)-1)*2+1);
                    else {
                       int t=mesto+1;
                        while(true){
                           if(a[mesto]==a[t]){
                                 bristih++;
                                 t++;
                           }
                           else break;
                        }
                        printf("%lld\n",(mesto-(n/2+1)-1)*2+1-bristih);
                    }
                }
                else{
                  if(br==0)printf("%lld\n",(mesto-(n/2+1)-1)*2);
                     else {
                        int t=mesto+1;
                        while(true){
                           if(a[mesto]==a[t]){
                                 bristih++;
                                 t++;
                           }
                           else break;
                        }
                           printf("%lld\n",(mesto-(n/2+1))*2-bristih);
                     }
                }

        }
            else if(b[i]<medi and b[i]>a[1]){
                mesto=findClosestr(n,b[i]);
                //cout<<mesto<<endl;

                  if(n%2==1){
                     if(br==0)printf("%lld\n",((n/2+1)-mesto+1)*2);
                        else {
                              int t=mesto+1;
                        while(true){
                           if(a[mesto]==a[t]){
                                 bristih++;
                                 t++;
                           }
                           else break;
                        }
                             printf("%lld\n",((n/2+1)-mesto)*2-bristih);
                        }
                  }
                  else{
                     if(br==0)printf("%lld\n",((n/2+1)-mesto)*2+1);
                        else {
                              int t=mesto+1;
                              while(true){
                              if(a[mesto]==a[t]){
                                 bristih++;
                                    t++;
                              }
                              else break;
                              }
                              printf("%lld\n",((n/2+1)-mesto-1)*2+1-bristih);
                        }
                  }
            }
}

return 0;
}
/*
10 1
1 3 5 6 7 8 9 11 12 13
10
*/