#include <iostream>
#include <map>
using namespace std;
int main() {
	int n, k, a, br = 0;
	map<int, int> m;
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		cin >> a;
		if (m[a] >= 1) m[a]++;
		else m[a] = 1;
	}
	for (map<int, int>::iterator it = m.begin(); it != m.end(); ++it) {
		if (it->second >= k) br++;
	}
	cout << br<<endl;
	for (map<int, int>::iterator it = m.begin(); it != m.end(); ++it) {
		if (it->second >= k) cout << it->first << endl;
	}
	return 0;
}