#include <iostream>

using namespace std;

int main()
{
    int N, Q, i, r, j, menjanje, k, levo=0, desno=0;
    cin>>N>>Q;
    
    int A[N], Apoz[N];
    
    for(i = 0; i<N; i++)
    {
        cin>>A[i];
        Apoz[i] = i-1;
    }
    
    for(i=0; i<N-1; i++)
    {
        for(j=i+1; j<N; j++)
        {
            if(A[j]<A[i])
            {
                menjanje=A[i];
                A[i]=A[j];
                A[j]=menjanje;
            }
        }
    }


    int B[Q];
    for(r = 0; r<Q; r++)
    {
        cin>>B[r];
        for(j = 0; j<N; j++)
        {
            if(B[r]==A[j])
            {
                k=j;
                continue;
            }
        }
        for(i = 0; i<Q; i++)
    {
        for(j = 0; j<N; j++)
        {
            if(Apoz[j]<k)
            {
                levo = levo + 1;
            }else if(Apoz[j]>k)
            {
                desno = desno + 1;
            }
        }
        if(B[r]>A[N-1])
        {
            cout<<B[i]<<", "<<A[i]<<endl;
            cout<<N<<endl;
        }else if(B[r]<A[0])
        {
            cout<<N+1<<endl;
        }else if(B[r]==A[N/2])
        {
            cout<<0<<endl;
        }else
        {
            cout<<levo-desno-1<<endl;
        }
        levo = 0;
        desno = 0;
    }
    }
  
    
    
    
    
    return 0;
}