#include <bits/stdc++.h>
#define ll long long

using namespace std;

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

  int N, Q;
  cin >> N >> Q;

  vector<int> A(N);

  for (int i = 0; i < N; i++)
  {
    cin >> A[i];
  }
  sort(A.begin(), A.end());

  int s = A.size();

  for (int i = 0; i < Q; i++)
  {
    int x;
    cin >> x;

    auto it = lower_bound(A.begin(), A.end(), x);
    int l = distance(A.begin(), it);

    if (A[N / 2] == x)
    {
      cout << "0\n";
      continue;
    }
    int e = 0;

    while (*it == x && it != A.end())
    {
      e++;
      it++;
    }
    int g = distance(it, A.end());

    int ans = 0;
    if (l > g)
      ans = l - g;
    else if (l < g)
      ans = g - l + 1;

    cout << (ans - e) << "\n";
  }
}