#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,q;
    cin>>n>>q;
    vector<int>a(n);
    vector<int>b(q);
    int x=0,y=0,m=0;
    for (int i = 0; i < n; i++)
    cin >> a[i];
    sort(a.begin(), a.end());
    for (int j = 0; j < q; j++)
    cin >> b[j];
    for(int k=0;k<q;k++){
    if(b[k]>=a[n-1]){cout<<n<<endl;break;}
    x=lower_bound(begin(a),end(a),b[k])-a.begin();
    y=upper_bound(begin(a),end(a),b[k])-a.begin();
    if(b[k]>=a[n-1])y=0;
    if(n%2==0)
    { m=n/2+1;
      if(b[k]==a[x]&&a[x]!=a[y-1])
      {
        if(x<m-1)cout<<n-2*x-1 <<endl;
        else if(x==m-1)cout<<0<<endl;
             else if(x>=m)cout<<2*x-n<<endl;
      }
      else if(b[k]==a[x]&&a[x]==a[y-1])
      {
        if(x<=m-1&&y>=m)cout<<0<<endl;
        else if(x<m-1&&y<m)cout<<n-2*(y-1)-1<<endl;
             else cout<<2*x-n<<endl;
      }
      else
        {if(x<m-1)cout<<n-2*x<<endl;
         else if(x==m-1)cout<<1<<endl;
              else cout<<2*x- n+1<<endl;
      }
    }
    else if(n%2==1)
    {m=(n+1)/2;
     if(b[k]==a[x]&&a[x]!=a[y-1])
       {
        if(x<m-1)cout<<n-2*x-1 <<endl;
        else if(x==m-1)cout<<0<<endl;
             else if(x>=m)cout<<2*x-n<<endl;
      }
      else if(b[k]==a[x]&&a[x]==a[y-1])
      {
        if(x<=m-1&&y>=m)cout<<0<<endl;
        else if(x<m-1&&y<m)cout<<n-2*(y-1)-1<<endl;
             else cout<<2*x-n<<endl;
      }
           else
        {
         if(x<m-1)cout<<n-2*x+1<<endl;
         else if(x==m)cout<<1<<endl;
              else cout<<2*x- n<<endl;
        }

    }

    }
    return 0;
}