#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define xx first
#define yy second
#define ff(i,s,f) for(int i=s;i<f;i++)
#define fb(i,s,f) for(int i=(s)-1;i>=f;i--)
#define ffi(i,s,f) for(int i=s;i<=f;i++)
#define fbi(i,s,f) for(int i=s;i>=f;i--)
#define srt(a) sort(a.begin(),a.end());
#define srtg(a,int) sort(a.begin(),a.end(),greater<int>())
#define lb(a,x) lower_bound(a.begin(),a.end(),x)
#define ub(a,x) upper_bound(a.begin(),a.end(),x)
#define fnd(a,x) find(a.begin(),a.end(),x)
#define ios ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef string str;

const int maxn=2e5+10;

int a[maxn],b[maxn];

void solve(){
    int n,q;
    cin>>n>>q;
    for(int i=0;i<n;i++) cin>>a[i];
    sort(a,a+n);
    while(q--){
        int b;
        cin>>b;
        int manji=lower_bound(a,a+n,b)-a;
        int veci=a+n-upper_bound(a,a+n,b);
        int l=0,r=n+2,res=-1;
        while(l<=r){
            int mid=(l+r)/2;
            if(manji<=(n+mid)/2 && veci<=(n+mid)-((n+mid)/2+1)){
                res=mid;
                r=mid-1;
            }else l=mid+1;
        }
        cout<<res<<"\n";
    }
}

int main(){
    ios;
    int t=1;
    //cin>>t;
    while(t--) solve();
    return 0;
}