#include <bits/stdc++.h>
using namespace std;

int main()
{
	int brojac=0;
	int N,K;
	cin >> N >> K;
	long long A[2*N+1]={0};
	string exit="n";
	while(exit != "y")
	{
		int temp;
		cin >> temp;
		A[temp+6]++;
		cout << "Input exit code (y)" << endl;
		cin >> exit;
	}
	cout << " " << endl;
	for(int i=0;i<2*N;i++)
	{
		if(A[i]>=K)
		{
			brojac++;
		}
	}
	cout << brojac << endl;
	for(int j=0;j<2*N;j++)
	{
		if(A[j]>=K)
		{
			cout << j-6 << " ";
		}
	}
}