#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){
      cout<<0<<endl;
   }
   else if(b[i]>a[n]){
      cout<<n<<endl;
   }
      else if(b[i]<a[1]){
         cout<<n+1<<endl;
      }
        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)cout<<(mesto-(n/2+1)-1)*2+1<<endl;
                    else {
                       int t=mesto+1;
                        while(true){
                           if(a[mesto]==a[t]){
                                 bristih++;
                                 t++;
                           }
                           else break;
                        }
                        cout<<(mesto-(n/2+1)-1)*2+1-bristih<<endl;
                    }
                }
                else{
                  if(br==0)cout<<(mesto-(n/2+1)-1)*2<<endl;
                     else {
                        int t=mesto+1;
                        while(true){
                           if(a[mesto]==a[t]){
                                 bristih++;
                                 t++;
                           }
                           else break;
                        }
                           cout<<(mesto-(n/2+1))*2-bristih<<endl;
                     }
                }

        }
            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)cout<<((n/2+1)-mesto+1)*2<<endl;
                        else {
                              int t=mesto+1;
                        while(true){
                           if(a[mesto]==a[t]){
                                 bristih++;
                                 t++;
                           }
                           else break;
                        }
                              cout<<((n/2+1)-mesto)*2-bristih<<endl;
                        }
                  }
                  else{
                     if(br==0)cout<<((n/2+1)-mesto)*2+1<<endl;
                        else {
                              int t=mesto+1;
                              while(true){
                              if(a[mesto]==a[t]){
                                 bristih++;
                                    t++;
                              }
                              else break;
                              }
                              cout<<((n/2+1)-mesto-1)*2+1-bristih<<endl;
                        }
                  }
            }
}

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