#include <bits/stdc++.h>

using namespace std;

int main()
{
    int N, Q;
    int temp = 0;
    vector<int> A;
    vector<int> B;
    vector<int> M;
    cin >> N >> Q;
    for(int i = 0; i < N; i++)
    {
        cin >> temp;
        A.push_back(temp);
    }
    for(int i = 0; i < Q; i++)
    {
        cin >> temp;
        B.push_back(temp);
    }
    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    int A1 = A[N / 2];
    int isInA;
    vector<int>::iterator it;
    for(int k = 0; k < Q; k++)
    {
        for(int p = 0; p < A.size(); p++)
        {
            if(B[k] == A[p])
            {
                isInA = 1;
                break;
            }
            else
            {
                isInA = 0;
            }
        }

        if(B[k] == A1)
        {
            M.push_back(0);
        }
        else if(isInA)
        {
            it = find(A.begin(), A.end(), B[k]);
            int n = it - A.begin();
            if(n > N / 2)
                M.push_back(n - N / 2);
            else
                M.push_back(N / 2 - n + 1);
        }
        else if(B[k] > A[A.size() - 1])
        {
            M.push_back(A.size());
        }
        else if(B[k] < A[0])
        {
            M.push_back(A.size() + 1);
        }
        else
        {
            A.push_back(B[k]);
            sort(A.begin(), A.end());
            it = find(A.begin(), A.end(), B[k]);
            int n = it - A.begin();
            if(n > N / 2)
                M.push_back(n - N / 2);
            else
                M.push_back(N / 2 - n + 1);
            A.erase(A.begin() + n);

        }
    }

    for(int j = 0; j < M.size(); j++)
    {
        cout << M[j];
        //if(j != M.size() - 1)
        cout << endl;
    }

    return 0;
}