#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++) {
        int n1=n;
        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 < n1; i++)
                if (x == niz[i])
                    pronadjen = i;
            if (pronadjen == -1) {
                long long i = 0;
                while (niz[i] < x)
                    i++;
                pronadjen = i;
                n1++;
                temp++;
            }
            if (pronadjen < n1 / 2) {
                if (n1 % 2 == 0)
                    temp--;
                temp += (n1/ 2 - pronadjen) * 2;
            } else {
                if (n1 % 2 == 1)
                    temp--;
                temp += (pronadjen - n1 / 2) * 2;
            }
            resenje.push_back(temp);
        }
    }
    for (long long i = 0; i < q-1; i++)
        cout << resenje[i] <<"\n";
    cout<<resenje[q-1];
}