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

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