#include <bits/stdc++.h>
using namespace std;

int resavac(int *niz, int n, int x){
   sort(niz, niz + n);
   int pokreti = 0;
   while (niz[n /2] != x) {
      niz[n] = x;
      ++n;
      sort(niz, niz + n);
      ++pokreti;
   }
   return pokreti;
}

int main()
{
    int N,Q,x,brojevi;
    cin>>N>>Q;
    int A[N],B[Q];
    for(int i=0;i<N;i++)
        cin>>A[i];
    for(int i=0;i<Q;i++)
        cin>>B[i];
    for(int i=0;i<Q;i++)
    {
        brojevi=resavac(A, N, B[i]);
        cout<<brojevi<<endl;

    }
}