#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
    int glas[10000000];
    int zelj[10000000];
    int n,q;
    int taj = -1;
    cin >> n >> q;
    for(int i = 0; i < n; i++){
        cin >> glas[i];
    }
    for(int i = 0; i < q; i++){
        cin >> zelj[i];
    }
    sort(glas, glas + n);
    
    
    for(int i = 0; i < q; i++){
        taj = -1;
        for(int j = 0; j < n; j++){
            if(zelj[i] == glas[j] && (n / 2) + 1 - taj > (n / 2) + 1 - j){
                taj = j + 1;
            }
        }
        if(taj != -1){
            if(n % 2 == 0){
                if(taj < n / 2 + 1){
                    cout << (n / 2 + 1 - taj) * 2 - 1 << endl;
                }else if(taj > n / 2 + 1){
                    cout << (taj - n / 2 - 1) * 2 << endl;
                }else{
                    cout << 0 << endl;
                }
            }else{
                if(taj < n / 2 + 1){
                    cout << (n / 2 + 1 - taj) * 2 << endl;
                }else if(taj > n / 2 + 1){
                    cout << (taj - n / 2 - 1) * 2 - 1 << endl;
                }else{
                    cout << 0 << endl;
                }
            }
            continue;
        }else{
            glas[n] = zelj[i];
            sort(glas, glas + n + 1);
            for(int j = 0; j <= n; j++){
                if(glas[j] == zelj[i]){
                    taj = j + 1;
                    break;
                }   
            }
            if((n + 1) % 2 == 0){
                if(taj < (n + 1) / 2 + 1){
                    cout << ((n + 1) / 2 + 1 - taj) * 2 << endl;
                }else if(taj > (n + 1) / 2 + 1){
                    cout << (taj - (n + 1) / 2 - 1) * 2 + 1 << endl;
                }else{
                    cout << 0 << endl;
                }
            }else{
                if(taj < (n + 1) / 2 + 1){
                    cout << ((n + 1) / 2 + 1 - taj) * 2 + 1 << endl;
                }else if(taj > (n + 1) / 2 + 1){
                    cout << (taj - (n + 1) / 2 - 1) * 2 << endl;
                }else{
                    cout << 0 << endl;
                }
            }
            
        }
    }
    return 0;
}