#define here cerr<<"===========================================\n"
#define dbg(x) cerr<<#x<<": "<<x<<endl;
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define ld double
#define ll long long
#define llinf 100000000000000000LL // 10^17
#define pb push_back
#define popb pop_back
#define fi first
#define sc second
#define endl '\n'
#define pll pair<ll,ll>
#define pld pair<ld,ld>
#define sz(a) (ll)(a.size())
#define all(a) a.begin(),a.end()
#define ceri(a,l,r) {cerr<<#a<<": ";for(ll i_ = l;i_<=r;i_++) cerr<<a[i_]<< " ";cerr<<endl;}
#define cer(a) {cerr<<#a<<": ";for(ll x_ : a) cerr<<x_<< " ";cerr<<endl;}

#define daj_mi_malo_vremena ios_base::sync_with_stdio(false);cerr.tie(0);cout.tie(0);cin.tie(0);

using namespace std;
#define maxn 400005
ll n,q;
ll a[maxn],v[maxn];
ll cnt[maxn];
ll ps[maxn];
set<ll> s;
map<ll,ll> mp;
ll it = 0;
int main(){
	daj_mi_malo_vremena;
    cin >> n >> q;
    for(ll i = 1;i<=n;i++) cin >> a[i];
    for(ll i = 1;i<=q;i++) cin >> v[i];
    sort(a+1,a+1+n);
    for(ll i = 1;i<=n;i++) s.insert(a[i]);
    for(ll i = 1;i<=q;i++) s.insert(v[i]);
    for(ll x : s) mp[x] = ++it;
    for(ll i = 1;i<=n;i++) a[i] = mp[a[i]];
    for(ll i = 1;i<=q;i++) v[i] = mp[v[i]];
    for(ll i = 1;i<=n;i++) cnt[a[i]]++;
    for(ll i = 1;i<=it;i++) ps[i] = ps[i-1] + cnt[i];
    ll cur = a[n/2+1];
    for(ll i = 1;i<=q;i++){
        ll x = v[i];
        if(cur==x){
            cout<<0<<endl;
            continue;
        }
        ll l = 1,r = 10*n,mid,rez;
        while(l<=r){
            mid = (l+r)/2;
            if(ps[x-1]+1<=(n+mid)/2+1&&(n+mid)/2+1<=ps[x]+mid) rez = mid,r = mid-1;
            else l = mid+1;
        }
        cout<<rez<<endl;
    }
	return 0;
}