#include <bits/stdc++.h>
using namespace std;
vector <int> brpojav, res;
int n,k;
int main() {
	cin >> n >> k;
	for (int i=0;i<2*n+1;i++)
	{
		brpojav.push_back(0);
	}
	for (int i=0;i<n;i++)
	{
		int pom;
		cin >> pom;
		brpojav[pom+n]++;
	}
	for (int i=0;i<2*n+1;i++)
	{
		if(brpojav[i]>=k) res.push_back(i-n);
	}
	int duz=res.size();
	cout << duz << endl;
	for (int l=0;l<duz;l++)
	{cout << res[l] << " ";}
	return 0;
}