#include <iostream>
#include <map>
using namespace std;

int main() {
    int n,m;
    cin>>n>>m;
    map<int,int>readers;//<读者,书>
    map<int,int>book;
    for(int i=0;i<n;i++){
        cin>>readers[i];
        book[readers[i]]++;
    }
    for(int i=0;i<n;i++){
        if(book[readers[i]]>1){
            cout<<book[readers[i]]-1<<endl;
        }else {
            cout<<"BeiJu"<<endl;
        }
    }
    return 0;
}
// 64 位输出请用 printf("%lld")