#include <bits/stdc++.h>

using namespace std;

int main()
{
    int mini, poz, t, n, q, ret = 0, w, ub;
    cin>>n>>q;
    vector <int> a;
    std::vector<int>::iterator p;
    int k = n/2+1, n1 = n;
    int b[q];
    for (int i = 0; i < n; i++)
    {
        cin>> w;
        a.push_back(w);
    }
    std::vector<int>::iterator fg;
    fg = a.begin();
    for (int i = 0; i < q; i++)
    {
        cin>> b[i];
    }
    for (int i = 0; i < n; i++)
    {
        mini = a[i];
        poz = i;
        for (int k = i; k < n; k++)
        {
            if (mini > a[k])
            {
                mini = a[k];
                poz = k;
            }
        }
        t = a[i];
        a[i] = a[poz];
        a[poz] = t;
    }
    for (int brojac = 0; brojac < q; brojac++)
    {
        for (bool i = true; i == true;)
        {
            if(a[k] == b[brojac])
            {
                if(k == n/2+1)
                {
                    b[brojac] = 2*k-n;
                }
                else
                {
                    b[brojac] = 2*k-n+1;
                }
                i = false;
                ret = 1;
            }
            else if(a[k] < b[brojac])
            {
                n1 = n1 - n1/2+1;
                k = k + n1/2+1 ;
            }
            else
            {
                n1 = n1 - n1/2-1;
                k = k - n1/2;
            }
            if (n1 == 1)
            {
                i = false;
            }
        }
        if (ret != 1)
        {
            p = lower_bound(a.begin(), a.end(), b[brojac]);
            ub =  std::distance(fg, p);
            b[brojac] = 2*ub-n;
        }
        ret = 0;
        k = n/2+1;
        n1 = n;
        cout<< b[brojac] << endl;
    }
    return 0;
}