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

std::vector<unsigned int> copyVector(std::vector<unsigned int> v) {
    std::vector<unsigned int> copy;
    std::copy(v.begin(), v.end(), std::back_inserter(copy));
    return copy;
}

int main() {
    unsigned int n, q;
    std::cin >> n >> q;
    std::vector<unsigned int> a;
    unsigned int b[q];
    for (int i = 0; i < n; i++) {
        int x;
        std::cin >> x;
        a.push_back(x);
    }
    for (int i = 0; i < q; i++) {
        std::cin >> b[i];
    }
    std::sort(a.begin(), a.end());
    std::vector<unsigned int> aBackup = copyVector(a);
    for (int i = 0; i < q; i++) {
        int count = 0;
        while (b[i] != a[a.size() / 2]) {
            a.push_back(b[i]);
            std::sort(a.begin(), a.end());
            count++;
        }
        std::cout << count << std::endl;
        a = copyVector(aBackup);
    }
    return 0;
}