#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
    int n, q;
    cin >> n >> q;
    int a[n];
    int m = n;
    if(n%2==0)
    {
        m++;
    }
    for(int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    sort(a, a+n);

    for(int i = 0; i < q; i++)
    {
        int b;
        cin >> b;
        int p = upper_bound(a, a+n, b)-a;
        if(p == n && a[n-1] == b)
        {
            cout << n-1 << endl;
        }
        else if (p == 0)
        {
            cout << n+1 << endl;
        }
        else if(p > 0 && a[p-1] == b)
        {
            if(p-1 > n/2)
            {
                cout << n-p << endl;
            }
            else if(p-1 < n/2)
            {
                cout << n-p-(p-1) << endl;
            }
            else
            {
                cout << 0 << endl;
            }
        }
        else
        {
            if(p > n/2)
            {
                cout << p-(n-p) << endl;
            }
            else if(p < n/2)
            {
                cout << n-p << endl;
            }
            else
            {
                cout << 1 << endl;
            }
        }
    }
    return 0;
}