#include <stdio.h>
#include <stdlib.h>
int main()
{
    long int n,k;
    scanf ("%ld %ld",&n,&k);
    int niz1[n],brojac,i,j,niz2[2*n+1];
    brojac=0;
    for (i=0;i<2*n+1;i++)
    	niz2[i]=0;
    for (j=0;j<n;j++)
	{
        scanf("%d",&niz1[j]);
    	niz2[niz1[j]+n]++;
    	if ( niz2[niz1[j]+n]==k)
		 brojac++;
    }
    printf("%d\n",brojac);
    for (i=0;i<2*n+1;i++)
        if (niz2[i]>=k)
        printf("%ld ",i-n);
}