#include <bits/stdc++.h>
using namespace std;
int n, q, med, r, k, j = 1; int a[200096]; int b[200096]; int aCOPY[200096];
void sorting(int a[200096], int n)
{
    sort(a + 1, a + n + 1);
    med = a[n / 2 + 1];
}
int main()
{
    scanf("%d", &n);
    scanf("%d", &q);
    for(int i = 1; i <= n; i++)
        scanf("%d", &a[i]);
    memcpy(aCOPY, a, sizeof(aCOPY));
    for(int i = 1; i <= q; i++)
        scanf("%d", &b[i]);
    for(int i = 1; i <= q; i++)
    {
        memcpy(a, aCOPY, sizeof(a));
        sorting(a, n);
        j = 1;
        while(j > 0)
        {
            if(b[i] != med)
            {
                a[n + j] = b[i];
                sorting(a, n + j);
                k ++; j ++;
            }
            else
            {
                printf("%d \n", k);
                k = 0; j = -1;
            }
        }
    }
    
    return 0;
}