#include <iostream>
#include <vector>
#include <unordered_map>

int main() {
    int K, N;
    std::cin >> K >> N;

    std::vector<int> numbers(N);
    bool wtf[N]={false};
    std::unordered_map<int, int> frequencyMap;
    for (int i = 0; i < N; i++) {
        std::cin >> numbers[i];
        frequencyMap[numbers[i]]++;
        if(frequencyMap[numbers[i]] >= K){
            if(wtf[numbers[i]]==false){
                std :: cout << numbers[i] << ' ';
                wtf[numbers[i]]=true;
            }
        }
    }

    

    

    std::cout ;

    return 0;
}