#include <bits/stdc++.h>

using namespace std;

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

int bs(int x, int l, int r)
{
    int mid = (l + r + 1) / 2;

    if(x == glasovi[mid - 1])
        return mid - 1;

    if(glasovi[mid - 1] < x && x <= glasovi[mid])
        return mid;
    else if (x <= glasovi[mid - 1])
        return bs(x, l, mid - 1);

    return bs(x, mid, r);
}


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);
    }

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

            int k = ind;
            int m = n;
            int l = m - ind - 1;

            int add = 0;

            if(upiti[i] != glasovi[ind])
            {
                add = 1;
                m++;
                l++;
            }

            if(l > k)
            {
                cout << add + l - k << '\n';
            }
            else if(k > l)
            {
                cout << add + k - l - 1 << '\n';
            }
            else
            {
                cout << add << '\n';
            }
        }
    }


    return 0;
}