#include <iostream>
using namespace std;

int main() {
    int a, b;
    cin>>a>>b;
    int n[a+1];
    for (int i=1; i<=a; i++) {
    cin>>n[i];
    }
    int count[b+1];
    for (int i=1; i<=b; i++) count[i]=0;
    for (int i=1; i<=a; i++){
        count[n[i]]++;//将每个数值出现的次数存储到数组count中
    }
    for (int i=1; i<=a; i++){
        if(count[n[i]]>1) cout<<count[n[i]]-1<<endl;
        else
         cout<<"BeiJu"<<endl;
    }


}
// 64 位输出请用 printf("%lld")