//土尔逊Torson 编写于2023/06/14
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <string>
#include <map>
using namespace std;
int main() {
int n, m;
while (scanf("%d%d", &n, &m) != EOF) {
map<int, int> bookFriend;
map<int, int> bookCount;
for (int i = 0; i < n; ++i) {
int bookNum;
scanf("%d", &bookNum);
bookFriend[i] = bookNum;
bookCount[bookNum]++;
}
for (int i = 0; i < n; ++i) {
int bookKey = bookFriend[i];
if (0 != bookCount[bookKey] - 1) {
printf("%d\n", bookCount[bookKey] - 1);
}
else {
printf("BeiJu\n");
}
}
}
system("pause");
return EXIT_SUCCESS;
}
// 64 位输出请用 printf("%lld")