#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());
    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 += (n1+1)/2 - pos;
        }
        else {
            res += pos * 2 - n1;
            if (res == -1) {
                res = 0;
            }
        }
        std::cout << res << std::endl;
    }
}

/*
std::vector<int> mergesort(std::vector<int> a) {
    if (a.size() == 1) return a;
    if (a.size() == 2) {
        if (a[0] > a[1]) {
            int p = a[1];
            a[1] = a[0];
            a[0] = p;
        }
        return a;
    }
    std::vector<int> x, y;
    int pivot = a.size() / 2;
    //std::cout << pivot << " " << a.size() << std::endl;
    for (int i = 0; i < pivot; i++) {
        x.push_back(a[i]);
        y.push_back(a[i + pivot]);
    }
    if (pivot * 2 != a.size()) {
        y.push_back(a[a.size()-1]);
    }
    x = mergesort(x);
    y =mergesort(y);

    int i = 0, j = 0;
    while (i < x.size() && j < y.size()) {
        if (x[i] <= y[j]) {
            a[i + j] = x[i];
            i++;
        }
        else {
            a[i + j] = y[j];
            j++;
        }
    }
    if (i < x.size()) {
        while (i < x.size()) {
            a[i + j] = x[i];
            i++;
        }
    }
    if (j < y.size()) {
        while (j < y.size()) {
            a[i + j] = y[j];
            j++;
        }
    }
    return a;
}

template <class T>
bool contains(std::vector<T> arr, T element) {
    for (int i = 0; i < arr.size(); i++) {
        if (arr[i] == element) return true;
    }
    return false;
}

int main()
{
    std::ios_base::sync_with_stdio(false); std::cin.tie(0);

    int n = 1000;
    std::vector<int> a;
    for (int i = 0; i < n; i++) {
        a.push_back(rand() % n);
    }
    a = mergesort(a);
    for (int i = 0; i < a.size(); i++) {
        std::cout << a[i] << " ";
    }
    std::cout << std::endl;
    std::cout << contains(a, 25) << " " << contains({ '1','3','2' }, '1') << std::endl;

}*/