#include <bits/stdc++.h>
using namespace std;
int n, q, m, a[200500], acopy[200500], b, c;
int main()
{
  scanf("%d %d", &n, &q);
  for(int i = 1; i <= n; i ++)
    scanf("%d", &a[i]);
  sort(a + 1, a + n + 1);
  memcpy(acopy,a,sizeof(acopy));
  for(int i = 1; i <= q; i++)
  {
    memcpy(a,acopy,sizeof(a));
    m = a[n / 2 + 1];
    c = 0;
    scanf("%d", &b);
    if(b > a[n])
      c = n;
    else if(b < a[1])
      c = n + 1;
    else if(b != m)
    {
      int x = n;
      while(b != m)
      {
        a[++x] = b;
        sort(a + 1, a + x + 1);
        m = a[x/ 2 + 1];
        c++;
      }
    }
    else
      c = 0;
    cout << c << "\n";
  }
  return 0;
}