#include <bits/stdc++.h>

using namespace std;

int main()
{ 
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n, q;
    cin >> n >> q;
    int glasovi[n +1];
    for(int i = 0; i<n;i++)
    {
        cin >> glasovi[i];        
    }
    int sol[q];
    sort(glasovi, glasovi+n);
    for(int i = 0; i < q;i++)
    {                               
        int q1;
        cin >> q1;
        int k = lower_bound(glasovi, glasovi+n, q1) -  glasovi +1;
       
        if((k-1) > (n-k))
        {
            sol[i] = ((k-1) - (n-k))-1;
        }
        else if((k-1) > (n-k) +1)
        {
            sol[i] =  ((k-1) - (n-k));
        }
         else sol[i] = 0;
        
        
    }
    for(int i = 0; i<q;i++){
        cout << sol[i] << "\n";
    }

    return 0;
}