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

int main() {
    std::ios_base::sync_with_stdio(false); std::cin.tie(0);
    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());
    int med = a[n / 2];

    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;;*/
        int l = 0;
        int r = n-1;
        int pos = -1;
        int n1 = n;
        int res = 0;
        while (l != r && (r-l) > 0) {
            int m = (l + r) / 2;
            //std::cout << m << std::endl;
            if (t == a[m]) {
                pos = m;
                if (pos == n / 2) {
                    break;
                }
                else if (pos < n / 2) {
                    l = m + 1;
                }
                else {
                    r = m - 1;
                }
            }
            else {
                if (t > a[m]) {
                    l = m + 1;
                }
                else {
                    r = m;
                }
            }
            //system("pause");
        }
        if (pos == -1) {
            pos = l;
            n1++;
            //std::cout << t << " " << pos << " " << l << " " << a[l] << " " << a[pos] << std::endl;
            if (t > a[l]) pos++;
            res++;
        }

        if (pos == n1 / 2) {
            //
        }
        else if (pos < n1 / 2) {
            res += 2*((n1)/2 - pos) + n1%2 - 1;
        }
        else {
            res += pos * 2 - n1;
            if (res == -1) {
                res = 0;
            }
        }
        std::cout << res << std::endl;
    }
}