#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main(){
    int N,Q;
    cin>>N>>Q;
    int* A=new int[N];
    for(int i=0;i<N;i++)
        cin>>A[i];
    int* B=new int[Q];
    for(int i=0;i<Q;i++)
        cin>>B[i];
    sort(A,A+N);
    sort(B,B+Q);
    int* indeksi=new int[Q];
    int l=0;
    bool* enchance=new bool[Q];
    enchance[0]=false;
    enchance[Q-1]=true;
    indeksi[Q-1]=N;
    for(int i=0;i<N;i++)
        if(A[i]==B[l]){
            indeksi[l]=i;
            l++;
            enchance[l]=false;
        }else if(A[i]>B[l]){
            indeksi[l]=i;
            enchance[l]=true;
            l++;
        }
    for(int i=0;i<Q;i++){
        /*
        q=0.5±0.5 tj. q€{0,1}
        final: x>0

        A - before:
            i+x=(N+x)//2+1
            i+x-1=(N+x)//2
            (i+x-1)*2+q=N+x
            2*i+2*x-2=N+x-q
            2*x-x=N-q+2-2*i
            x=N-q+2-2*i
            lowestX: x=N+1-2*i
        B - after:
            i=(N+x)//2+1
            x=(i-1)*2+q-N
            lowestX: x=2*i-2-N
        WOWIE:
            A.lowestX = 1-B.lowestX
            A.X = -B.X
        NAPOMENA: INDEKSIRAN JE OD 1 :'( $
                   [=1 in Perl
        */
        int curN=N+(enchance[i]?1:0);
        int a=curN+1-2*(indeksi[i]+1);
        //int b=((indeksi[i]+1)-1)*2-curN;
        int b=indeksi[i]*2-curN;
        if(b<0)
            cout<<"a: "<<a+(enchance[i]?1:0);
        else
            cout<<"b: "<<b+(enchance[i]?1:0);
        cout<<endl;
    }
    return 0;
}