#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>

using namespace std;

int main()
{
    int N, q1;
    int q, k, n; 
    bool p = 0, tmp = 1;
    
    cin >> N >> q1;
    
    int g = (floor(N/2)+1);    
    vector <int> a(N);
    
    for(int i = 1;i <= N;i ++)
    {
        cin >> a[i];
    }
    
    sort(a.begin(), a.end());
    
    for(int i = 0;i < q1;i ++)
    {
        p = 0;tmp = 1;
        
        cin >> q;
        
        for(int j = 1;j <= N;j ++)
        {
            if(a[j] == q)
            {
                p = 1;
                k = j;
            }
        }
        
        if(a[g] == q)
        {
            cout << 0 << endl;
        }
        else
        if(!p)
        {
            for(int j = 1;j < N;j ++)
            {
                if(a[j] < q && a[j+1] > q)
                {
                    k = j+1;tmp = 0;
                }
            }
            if(tmp)
            {
                k = N+1;
            }
        }
        
        n = 2*k - 2;
        cout << abs(n-N) << endl;
    }
    
    return 0;
}