#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

ll a[10000000], b[100000000];


ll bin_pret(ll *a, ll starti, ll endi, ll val) {

   if( starti == endi )
      return a[starti] <= val ? starti : -1;

   ll midi = starti + (endi - starti) / 2;

   if( val < a[midi] )
      return bin_pret( a, starti, midi, val );

   ll ret = bin_pret( a, midi+1, endi, val );
   return ret == -1 ? midi : ret;
}

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

    ll n, q, p;
    cin>> n>> q;

    for(ll i=0;i<n;i++)
        cin>> a[i];
    for(ll i=0;i<q;i++)
        cin>> b[i];


    sort(a, a + n);


    for(int i=0;i<q;i++){
        if (a[n/2] == b[i])
            cout<<"0\n";
        else{
            p = bin_pret(a, 0, n-1, b[i]-1);
            cout<<2*p+2-n<<"\n";
        }
    }
    return 0;
}