#include <iostream>
#include <unordered_map>
#include <cmath>
#include <vector>
#include <map>
#include <algorithm>
#include <string>

int main() {
    int n, q;
    std::cin >> n >> q;
    std::vector<int> a, a1, b;
    for (int i = 0; i < n; i++) {
        int t;
        std::cin >> t;
        a.push_back(t);
    }
    std::sort(a.begin(), a.end());

    for (int j = 0; j < q; j++) {
        int t;
        std::cin >> t;
        int pos = -1;
        int n1 = n;
        int res = 0;
        for (int i = 0; i < n; i++) {
            if (t <= a[i]) {
                pos = i;
                if (t < a[i]) {
                    n1++;
                    res++;
                }
                //1 3 3 3 5
                break;
            }
        }
        if (pos == -1) {
            pos = n;
            n1++;
            res++;
        }
        if (pos == n1 / 2) {
            //
        }
        else if (pos < n1/2) {
            res += pos + 1 - (n1 % 2 == 0);
        }
        else {
            res += pos * 2 - n1;
            if (res == -1) {
                res = 0;
            }
        }
        std::cout << res << std::endl;;
    }
}