#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned u;

#define INF INT_MAX
#define MOD (1000000007)
#define PI arccos(-1)

#define pll pair<long long, long long>
#define mp make_pair

#define vll vector<ll>
#define vb vector<bool>
#define vs vector<string>
#define vp vector<pll>
#define pb push_back
#define all(v) v.begin(), v.end()
#define print_vect(v) for (auto it : v) cout << it << " ";

#define pq priority_queue<ll>
#define pqg priority_queue<ll, vll, greater<ll>>
#define set set<ll>
#define mset multiset<ll>
#define queue queue<ll>

ll add(ll a, ll b) { a += b; return a >= MOD ? a - MOD : a; }
ll sub(ll a, ll b) { a -= b; return a < 0 ? a + MOD : a; }
ll mul(ll a, ll b) { return (long long)(a) * (long long)(b) % MOD; }
 
void sadd(ll &a, ll b) { a = add(a, b); }
void ssub(ll &a, ll b) { a = sub(a, b); }
void smul(ll &a, ll b) { a = mul(a, b); }

ll nzs(ll a, ll b){ 
    return (a / __gcd(a, b)) * b; 
}

const ll N = 1e9 + 5;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n, q;
    cin >> n >> q;
    vll a(n);
    for(ll i = 0 ; i < n ; i++){
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    ll med = n / 2;
    for(ll i = 0 ; i < q ; i++){
        ll broj;
        cin >> broj;
        vll::iterator low, upp;
        low = lower_bound(all(a), broj);
        upp = upper_bound(all(a), broj);
        ll ilow = (low - a.begin());
        ll iupp = (upp - a.begin());
        if(ilow <= med && iupp >= med){
            cout << 0 << "\n";
        }
        else if(abs(ilow - med) < abs(iupp - med)){
            ll br = abs(ilow - med) - (n % 2);
            ll ans = (n % 2);
            ans += br * 2;
            cout << ans << "\n";
        }
        else{
            ll br = abs(iupp - med) - (n % 2);
            ll ans = (n % 2);
            ans += br * 2;
            cout << ans << "\n";
        }
    }
    
    return 0;
}