#include <bits/stdc++.h>

using namespace std;

vector <int> a;
int n, q;


int najblizi_sredini_l(int l, int r, int x)
{
    int m = l + (r-l) / 2;
    if(r > l)
    {
        if(x == a[m])
        {
            return najblizi_sredini_l(m+1, r, x);
        }
        else
        {
            return najblizi_sredini_l(l, m-1, x);
        }
    }
    else
        return m;
}
int najblizi_sredini_r(int l, int r, int x)
{
    int m = l + (r-l) / 2;
    if(r > l)
    {
        if(x == a[m])
        {
            return najblizi_sredini_r(l, m-1, x);
        }
        else
        {
            return najblizi_sredini_r(m+1, r, x);
        }

    }
    else
        return m;
}
int najveci_manji(int x, int l, int r)
{
    int m = l + (r-l) / 2;
    if(r >= l)
    {
        if(x == a[m])
        {
            if(m == n/2)
                return m;
            else if(m < n/2)
                return najblizi_sredini_l(m, n/2, x);
            else
                return najblizi_sredini_r(n/2, m, x);

        }
        else if(x > a[m])
            return najveci_manji(x, m+1, r);
        else
            return najveci_manji(x, l, m-1);
    }
    if(m == n/2)
        return m;
    else if(m < n/2)
        return najblizi_sredini_l(m, n/2, x);
    else
        return najblizi_sredini_r(n/2, m, x);

}

int main()
{
    cin >> n >> q;
    for(int i = 0; i < n; i++)
    {
        int p;
        cin >> p;
        a.push_back(p);
    }
    sort(a.begin(), a.end());

    for(int i = 0; i < q; i++)
    {
        int b;
        cin >> b;

        int j = najveci_manji(b, 0, n-1);
        if(j == n)
        {
            cout << n << endl;
        }
        else if(a[j] == b)
        {
            int p = abs(n-1-j-j);
            if(p == 0 || j < n/2)
            {
                cout << p << endl;
            }
            else
            {
                cout << p - 1 << endl;
            }
        }
        else if(j == 0)
        {
            cout << n+1 << endl;
        }
        else
        {
            if(a[j+1] == b)
            {
                int p = abs(n-1-j-j);
                if(p == 0 || j < n/2)
                {
                    cout << p << endl;
                }
                else
                {
                    cout << p - 1 << endl;
                }
            }
            else if(a[j-1] == b)
            {
                int p = abs(n-1-j-j);
                if(p == 0 || j < n/2)
                {
                    cout << p << endl;
                }
                else
                {
                    cout << p - 1 << endl;
                }
            }
            else
            {
                if(j < n - j)
                {
                    cout << n - 2*j + 1 << endl;
                }
                else if(j == n - j)
                {
                    cout << 1 << endl;
                }
                else
                {
                    cout << abs(n - j - j) << endl;
                }
            }
        }
    }

    return 0;
}