#include <bits/stdc++.h>

using namespace std;

vector<int> glasovi;
vector<int> upiti;

int bs(int x, int l, int d)
{
    if(l > d)
        return d;

    int mid = (d + l) / 2 + (d + l) % 2;

    if(glasovi[mid] == x)
        return mid;
    if(glasovi[mid] > x)
        return bs(x, l, mid);

    return bs(x, mid, d);
}

int main()
{
    int n;
    int q;

    cin >> n;
    cin >> q;

    for(int i = 0; i < n; i++)
    {
        int a;
        cin >> a;
        glasovi.push_back(a);
    }

    sort(glasovi.begin(), glasovi.end());

    for(int i = 0; i < q; i++)
    {
        int b;
        cin >> b;
        upiti.push_back(b);
    }

    for(int i = 0; i < q; i++)
    {
        if(upiti[i] > glasovi[n - 1] || upiti[i] < glasovi[0])
            cout << n << '\n';
        else
        {
            int ind = bs(upiti[i], 0, n - 1);

            if(glasovi[ind] == upiti[i])
            {
                int med = n / 2 + 1;
                if(n % 2 == 0)
                {
                    if(ind == med)
                    {
                        cout << 0 << '\n';
                    }
                    else if(ind < med)
                    {
                        cout <<  2 * abs(med - ind) - 1 << '\n';
                    }
                    else
                    {
                        cout <<  2 * abs(med - ind) << '\n';
                    }
                }
                else
                {
                    if(ind == med)
                    {
                        cout << 0 << '\n';
                    }
                    else if(ind < med)
                    {
                        cout <<  2 * abs(med - ind) << '\n';
                    }
                    else
                    {
                        cout <<  2 * abs(med - ind) - 1 << '\n';
                    }
                }
            }
            else
            {
                int med = (n + 1) / 2 + 1;
                if(n % 2 == 0)
                {
                    if(ind == med)
                    {
                        cout << 0 << '\n';
                    }
                    else if(ind < med)
                    {
                        cout <<  2 * abs(med - ind) - 1 << '\n';
                    }
                    else
                    {
                        cout <<  2 * abs(med - ind) << '\n';
                    }
                }
                else
                {
                    if(ind == med)
                    {
                        cout << 0 << '\n';
                    }
                    else if(ind < med)
                    {
                        cout <<  2 * abs(med - ind) << '\n';
                    }
                    else
                    {
                        cout <<  2 * abs(med - ind) - 1 << '\n';
                    }
                }
            }
        }
    }

    return 0;
}