#include <bits/stdc++.h>
#define ll long long
#define en '\n'
#define sp ' '

using namespace std;

int binarna (vector<int> A, int x, int l, int r, int med)
{
   while (l <= r)
   {
       int mid = (l + r) / 2;
       if (A[mid] == x)
            return mid;
       if (A[mid] > x)
           r = mid - 1;
       else
           l = mid + 1;
   }
   if (r < med)
        return r;
   return l;
}

int main()
{
    int N, Q;
    cin >> N >> Q;
    vector<int> A (N);
    for (int i = 0; i < N; i++)
        cin >> A[i];
    sort(A.begin(),A.end());
    int p = N / 2;
    int med = A[p];
    vector <int> B (Q);
    for (int i = 0; i < Q; i++)
        cin >> B[i];
    for (int i = 0; i < Q; i++)
    {
        int poz = -1;
        int b = B[i];
        if (b == med)
            poz = p;
        else if (b >= A[0] && b < med)
            poz = binarna(A, b,0,p - 1,p);
        else if (b > med && b <= A[N - 1])
            poz = binarna(A, b,p + 1,N - 1,p);
        else if (b < A[0])
            poz = -1;
        else if (b > A[N - 1])
            poz = N;
        if (N % 2 == 0)
        {
            if(poz < p)
                cout << (p - poz) * 2 - 1 << en;
            else
                cout << (poz - p) * 2 << en;
        }
        else
        {
            if(poz > N / 2)
                cout << (poz - p) * 2 - 1 << en;
            else
                cout << (p - poz) * 2 << en;
        }
    }
}