#include <iostream>
#include <algorithm>

using namespace std;


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

    while (a[(n - 1)/2] != x) {
        a[n] = x;
        ++n;
        sort(a, a + n);
        br++;

        if (n%2 == 0){
            if (a[n/2] == x)
                break;

            else {
                a[n] = x;
                ++n;
                sort(a, a + n);
                br++;
            }
        }
   }

   return br;
}

int nadjiBrojZaMedijanuPARAN(int a[], int n, int x){
    sort(a, a + n);
    int br = 0;
    while (a[n /2] != x) {
        a[n] = x;
        ++n;
        sort(a, a + n);
        br++;

        if (n%2 != 0){
            if (a[(n - 1)/2] == x){
                break;
            }
            else {
                a[n] = x;
                ++n;
                sort(a, a + n);
                br++;
            }
        }
   }

   return br;
}

bool paran(int n){
    if (n%2 == 0)
        return true;
    else return false;
}

int main()
{
    int n, q;
    cin >> n >> q;
    int a[n], b[q];

    int res;

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

    for (int j = 0; j < q; j++){
        cin >> b[j];

        if (paran(n)){
            res = nadjiBrojZaMedijanuPARAN(a, n, b[j]);
            cout << res << endl;
        }

        else {
            res = nadjiBrojZaMedijanuNEPARAN(a, n, b[j]);
            cout << res << endl;
        }

    }

    return 0;
}