#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 low = lower_bound(A.begin(), A.end(), x);
    int l = distance(A.begin(), low);

    if (A[N / 2] == x)
    {
      cout << "0\n";
      continue;
    }
    auto up = upper_bound(A.begin(), A.end(), x);
    int e = distance(low, up);
    int g = distance(up, A.end());

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

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