#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main() {
    long long n, q, medijan, x, temp, pronadjen = -1;
    cin >> n >> q;
    vector < long long > original;
    vector < long long > resenje;
    for (int i = 0; i < n; i++) {
        cin >> temp;
        original.push_back(temp);
    }
    sort(original.begin(), original.begin() + n);
    medijan = original[n / 2];
    for (int i = 0; i < q; i++) {
        vector < long long > niz(original);
        pronadjen = -1;
        temp = 0;
        cin >> x;
        if (medijan == x)
            resenje.push_back(0);
        else {
            for (long long i = 0; i < niz.size(); i++)
                if (x == niz[i])
                    pronadjen = i;
            if (pronadjen == -1) {
                long long i = 0;
                while (niz[i] < x)
                    i++;
                if (i < niz.size())
                    niz.insert(niz.begin() + i, x);
                else
                    niz.push_back(x);
                sort(niz.begin(), niz.begin() + niz.size());
                for (long long i = 0; i < niz.size(); i++)
                    if (x == niz[i])
                        pronadjen = i;
                temp++;
            }
            if (pronadjen < niz.size() / 2) {
                if (niz.size() % 2 == 0)
                    temp--;
                temp += (niz.size() / 2 - pronadjen) * 2;
            } else {
                if (niz.size() % 2 == 1)
                    temp--;
                temp += (pronadjen - niz.size() / 2) * 2;
            }
            resenje.push_back(temp);
        }
    }
    for (long long i = 0; i < q - 1; i++)
        cout << resenje[i] << "\n";
    cout << resenje[q - 1];
}