#include <iostream>
#include <math.h>

using namespace std;

int main()
{
    int nvotes = 0, nquestions = 0;
    cin >> nvotes >> nquestions;
    int votes[nvotes];
    int questions[nquestions];
    int iv = 0, iq = 0;
    while (iv < nvotes){
        cin >> votes[iv];
        iv++;
    }
    while (iq < nquestions){
        cin >> questions[iq];
        iq++;
    }
    
    for(int i=0;i<nvotes-1;i++){
        for(int j=i+1;j<nvotes;j++){
            if(votes[i]>votes[j]){
                int tmp = votes[i];
                votes[i] = votes[j];
                votes[j] = tmp;
            }
        }
    }
    int imedijan = (nvotes/2+1)-1;
    int odgovor_broj_glasova = 0;
    
    for(int i = 0; i < nquestions; i++){
        
        int inadjen = -1;
        for(int j = 0; j <= nvotes/2; j++){
           if(votes[j] == questions[i]){
               inadjen = j;
           }
           if(votes[nvotes-1 - j] == questions[i]){
               inadjen = nvotes-1 - j;
           }
           
        }
        
        int p = -1;
        if(inadjen != -1){
            p = inadjen;
        } else
        {
            p = 0;
            while (p < nvotes && votes[p] <= questions[i]){
                p++;
            }
        }
        
        
        int N=0, m=0;
        if (inadjen == -1){
            N = nvotes + 1;
            m = N/2;
        }   
        else {
            N = nvotes;
            m = N/2;
        }
        
        int korekcija_parnost = 0;
        if(N%2==0){
            korekcija_parnost = 1;
        }
        
        int korekcija_nije_postojao_u_nizu = 0;
        if(inadjen == -1){
            korekcija_nije_postojao_u_nizu = 1;
        }
        
        int pomeraj = 0;
        if (m>=p){
            pomeraj = 2*(m-p) - korekcija_parnost;
        } else {
            pomeraj = 2*(p-m) + korekcija_parnost - 1;
        }
             
        odgovor_broj_glasova = pomeraj + korekcija_nije_postojao_u_nizu;     
    
        cout << odgovor_broj_glasova << endl;
    }
    
    return 0;
}