#include <iostream>
using namespace std;
int main()
{
	int n,k,brojac=0;
    cin >>n;
    int a[n],brojevi[2*n+1],konacno[2*n];
    for (int i=0;i<=2*n;i++)
    {
    	brojevi[i]=0;
    }
    cin>>k;
    for (int i=0;i<n;i++)
    {
    	cin >>a[i];
        brojevi[a[i]+n]++;
    }
    for (int i=0;i<=2*n;i++)
    {
    	if(brojevi[i]>=k)
    	{
    	    konacno[brojac]=i-n;
    	    brojac++;
    	}
    }
    cout <<brojac<<endl;
    for (int i=0;i<brojac;i++)
    {
        cout <<konacno[i]<<" ";
    }
    return 0;
}