#include <iostream>
#include <list>
#include <vector>
#include<algorithm>

using namespace std;

int main()
{
    int N, Q;
    cin >> N >> Q;
    
    vector<int> A, B;
    vector<int> Bindex;    

    int i;
    int seged;
    for (i = 0; i < N; i++) {
        cin >> seged;
        A.push_back(seged);
    }

    for (int i = 0; i < Q; i++) {
        cin >> seged;
        B.push_back(seged);        
    }
    
    sort(A.begin(), A.end());
    for (int k = 0; k < Q; k++) {
        int j;
        for (j = 0; j < N; j++)
            if (A[j] == B[k])
                break;
        Bindex.push_back(j + 1);
        //cout << j << "\n";
    }

    int M = 0;
    float dif = 0;
    for (i = 0; i < Q; i++) {        
        M = 0;
        while (true)
        {
            dif = abs((N + M) / 2.0 - Bindex[i]);

            if (dif != 0.5)
                M++;
            else
                break;
        }
        cout << M << "\n";
    }

}