#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int N , Q;
    cin >> N >> Q;
    int medijana = N / 2 + 1; 
    vector<long long> glasovi(N);
    for(int i = 0; i < N; i++)
    { 
        cin >> glasovi[i];
    }
    sort(glasovi.begin(), glasovi.end());
    long long GlasKojiTrazimo;
    long long lower, upper;
    for(int i = 0; i < Q; i++)
    { 
        cin >> GlasKojiTrazimo;
        lower = lower_bound(glasovi.begin(), glasovi.end(), GlasKojiTrazimo) - glasovi.begin();
        upper = upper_bound(glasovi.begin(), glasovi.end(), GlasKojiTrazimo) - glasovi.begin();

        if(medijana <= upper  && medijana >= lower + 1)
        { 
            cout << 0 << endl;
        }
        else if(medijana < lower + 1) 
        {   
            cout << 2 * lower - N << endl; 
        }
        else if( medijana > upper)
        { 
           if(upper == 0)
           { 
            cout << N - upper + 1<< endl;
           }
           else{ 
            cout << N - upper  << endl;
           } 

        }
    }
    
    
    return 0;
}