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

int main()
{
    int N,Q;
    scanf("%d%d",&N,&Q);
    int i = 0;
    int A[N];
    int B[Q];
    int x[2 * N];
    for (i = 0; i < N; i++)
    {
        scanf("%d",&A[i]);
        x[i] = A[i];
    }
    int j = 0;

    for (i = 0; i < Q; i++)
    {
        scanf("%d",&B[i]);
    }
    i = N - 1;
    int k = N;
    sort(A,A + N);
    int M = A[N / 2];
        int br = 0;
        for (j = 0; j < Q; j++)
        {
            k = N;
            br = 0;
            for (i = 0; i < N; i++)
            {
                x[i] = A[i];
            }
            i = N - 1;
            if (B[j] != A[i] && B[j] > A[N - 1])
            {
                while (M != B[j])
                {
                    x[k++] = B[j];
                    M = x[k / 2];
                    br++;
                    if (M == B[j]) break;

                }
            }
            else
            {
                for (i = N - 1; i >= 0; i--)
                {
                    if (A[i] == B[j])
                    {
                        while (M != B[j])
                        {
                            x[k++] = B[j];
                            M = x[k / 2];
                            br++;
                            if (M == B[j]) break;
                        }
                        if (M == B[j]) break;

                    }
                }
            }
            printf("%d\n",br);
        }
    return 0;
}