#include <iostream>
#include <algorithm>

using namespace std;

int p(int b[], int n, int x)
{
    int l = 0, d = n - 1;
    
    while (l - d > 1) {
        int m = (l + d) / 2;
        if (b[m] < x) l = m + 1;
        else d = m;
    }
    
    return b[l] == x || b[d] == x;
}
 

int calc(int a[], int n, int x) {
    int i = 0;
    int result;
    int mid = n / 2;
    while (a[i] < x && i < n) i++;
    
    while (a[i + 1] == a[i] && i < mid) i++;
    
    bool in = p(a, n, x);
    bool even = n % 2 == 0;
    
    
    if (a[mid] == x) return 0;
    return abs(2 * i - n) - (i <= mid && in ? 1 : i <= mid ? -1 : 0);
}

int main()
{
    int N, Q;
    cin >> N >> Q;
    int n[N], q[Q];
    
    for (int i = 0; i < N; i++) cin >> n[i];
    for (int i = 0; i < Q; i++) cin >> q[i];
    
    sort(n, n + N);
    
    for (int i = 0; i < Q; i++) {
        int res = calc(n, N, q[i]);
        cout << res << endl;
    }

    return 0;
}