#include <bits/stdc++.h>

using namespace std;

int poz (int q, int k, vector < int >a)
{
  if (q == a[0])
  k = 0;
  while (q != a[k])
    {
      if (q < a[k])
	  k -= k / 2;
      else
	  k += k / 2;
    }
  return k;
}

int main ()
{
    long long n, q, x, k, res, g;
    cin >> n >> q;
    vector < int >a, c;

    for (int i = 0; i < n; i++)
      {
        cin >> x;
        a.push_back (x);
      }
    sort (a.begin (), a.end ());

    for (int i = 0; i < q; i++)
    {
        cin >> x;
        if (x > a[n - 1])
	        res = n;
	    else if (x < a[0])
	        res = n+1;
	    else if(x == a[n - 1])
	        res = n-2;
        else
        {	
            k = n / 2;
            g = poz (x, k, a);
            if (g == n/2)
            res = 0;
            else
           { res = abs (g * 2 - n);
            if (g< n/2)
            res-=1;}
        }
        c.push_back (res);
    }
    for (int i = 0; i < q; i++)
        cout << c[i] << endl;
  return 0;
}