#include <iostream>
#include<vector>
using namespace std;

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