#include <iostream>
#include <algorithm>

using namespace std;

int nadjiBrojZaMedijanu(int a[], int n, int x){
    sort(a, a+n);
    int br = 0;

    for (br = 0; a[n/2] != x; br++){
        a[n++] = x;
        sort(a, a+n);
    }

    return br;
}

int main()
{
    int n, q;
    cin >> n >> q;

    int a[n], b[q];

    int pom[n];

    for (int i = 0; i < n; i++){
            cin >> a[i];
            pom[i] = a[i];
    }

    for (int j = 0; j < q; j++){
        cin >> b[j];
        cout << nadjiBrojZaMedijanu(a, n, b[j]) << endl;
        copy (pom, pom+n, a);
    }

    return 0;
}