#include <bits/stdc++.h>
#define ll long long
#define MAXN 200020
using namespace std;
ll a[MAXN];
int main()
{
    ios::sync_with_stdio(false); cin.tie(0);
    ll n;
    ll q;
    cin >> n;
    cin >> q;
    for(ll i = 1; i <= n; i++)
        cin >> a[i];
    sort(a + 1, a + 1 + n);
    for(ll i = 1; i <= q; i++){
        ll b;
        cin >> b;
        ll mesto = (lower_bound(a + 1, a + 1 + n, b) - a);
        if(a[mesto] == b){
            ll left = mesto - 1;
            ll rigth = n - mesto;
            if(mesto == (n / 2 + 1))
                cout << 0 << '\n';
            else if(mesto > (n / 2 + 1)){
                cout << left - rigth - 1 << '\n';
            }
            else {
                cout << rigth - left << '\n';
            }
        }
        else{
            ll left = mesto - 1;
            ll rigth = n - mesto + 1;
            if(mesto == ((n + 1) / 2 + 1))
                cout << 1;
            else if(mesto > ((n + 1) / 2 + 1)){
                cout << left - rigth << '\n';
            }
            else cout << rigth - left + 1 << '\n';
        }
    }
}