#include <iostream>
#include <vector>

using namespace std;

int main()
{
	int n, k, br=0;
	cin >> n;
	cin >> k;
	vector <int> a(n);
	vector <int> b(2 * n + 1);
	for (int i = 0; i < n; i++)
		cin >> a[i];
	for (int i = 0; i < n; i++)
		b[a[i] + n]++;
	for (int i = 0; i < 2 * n + 1; i++)
		if (b[i] >= k) br++;
	cout << br << endl;
	for (int i = 0; i < 2 * n + 1; i++)
		if (b[i] >= k) cout << i - n << " ";
}