#include <iostream>
#include <vector>

using namespace std;

int main() {
    long int n,k;
    cin >> n >> k;
    vector<long int> brojevi;
    vector<long int> vrednosti;
    for (long int i = 0; i < 2*n+1; i++) vrednosti.push_back(0);
    for (long int i = 0; i < n; i++) {
        long int bruh;
        cin >> bruh;
        brojevi.push_back(bruh);
        vrednosti[bruh+n]++;
    }
    int broj = 0;
    vector<long int> popravljati;
    for (long int i = 0; i < n*2 +1; i++) {
        if (vrednosti[i] >= k) {
            broj++;
            popravljati.push_back(i-n);
        }
    }
    cout << broj << endl;
    for (long int i = 0; i < popravljati.size(); i++) cout << popravljati[i] << " ";

}