#include <iostream>
#include <bits/stdc++.h>
using namespace std;


int main()
{


    int B;
    int N,Q;
    cin>>N;
    cin>>Q;
    vector<int>A(N);
    for(int i=0;i<N;i++){cin>>A[i];}
    sort(begin(A),end(A));
    int med=A[N/2];
    for(int i=0;i<Q;i++){
    cin>>B;
    if(B==med){
    cout<<0<<endl;
    continue;}
    if(B<A[0]){
    cout<<N+1<<endl;
    continue;}
    if(B>A[N-1]){
    cout<<N<<endl;
    continue;}
    if(B<med){
    cout<<N-1-2*((upper_bound(A.begin(),A.end(),B)-A.begin())-1)<<endl;
    continue;}
    if(B>med){
    cout<<2*(lower_bound(A.begin(),A.end(),B)-A.begin())-N<<endl;
    continue;}}
    return 0;}