#include <iostream>
#include <algorithm>

using namespace std;

int search(int arr[], int n, int x)
{
    int lower = 0, upper = n - 1;
    
    while (upper - lower > 1) {
        int mid = (lower + upper) / 2;
        if (arr[mid] < x) lower = mid + 1;
        else upper = mid;
        
    }
    
    return arr[lower] == x || arr[upper] == x;
}
 

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

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

    return 0;
}