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

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

    std::vector<int> numbers(N);
    for (int i = 0; i < N; i++) {
        std::cin >> numbers[i];
    }

    std::unordered_map<int, int> frequencyMap;

    for (const auto& num : numbers) {
        frequencyMap[num]++;
    }

    bool found = false;

    for (const auto& pair : frequencyMap) {
        if (pair.second >= K) {
            std::cout << pair.first << " ";
            found = true;
        }
    }

    std::cout ;

    return 0;
}