#include<bits/stdc++.h>
#define ll long long
#define MAXN 200007
using namespace std;
ll a[MAXN];
int solve(int n, ll b)
{
    auto it1 = lower_bound(a,a+n,b);
    auto it2 = upper_bound(a,a+n,b);
    int k=0;
    if(*it1!=b || it1==a+n)
    {
        n++;
        k=1;
    }
    int p1=it1-a;//leva
    int p2=it2-1-a;//desna
    if(k)p2++;
    int m=n/2;
    if(p2<m) return n-2*p2-1+k;
    else if(p1>m)return n-2*(n-p1-1)-2+k;
    else return 0+k;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int n,q;
    cin>>n>>q;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    while(q--)
    {
        ll b;
        cin>>b;
        cout<<solve(n,b)<<endl;
    }
    return 0;
}