#include <iostream>
using namespace std;

const int N=210;
int book[N];//存储每本书有多少人喜欢
int read[N];//存储每个人最喜欢的书

int main() {
    int n,m;
    cin>>n>>m;
    for(int i=0;i<n;i++) {
        cin>>read[i];
        book[read[i]]++;
    }
    for(int i=0;i<n;i++){
        if(book[read[i]]==1) cout<<"BeiJu"<<endl;
        else cout<<book[read[i]]-1<<endl;
    }
    return 0;
}