#include <iostream>
#include <queue>
#include <unistd.h>
#include "queue"
#include "unordered_map"
using namespace std;

int main() {
    int N, M;
    while (cin >> N >> M) { // 注意 while 处理多个 case
        queue<int> readerQueue;
        unordered_map<int, int> bookMap;
        while (N--) {
            int temp;
            cin >> temp;
            readerQueue.push(temp);
            bookMap[temp]++;
        }
        while (!readerQueue.empty()) {
            int book = readerQueue.front();
            readerQueue.pop();
            auto it = bookMap.find(book);
            if (it->second==1) cout << "BeiJu" << endl;
            else cout << it->second-1<<endl;
        }
    }
}
// 64 位输出请用 printf("%lld")