#include <stdio.h>
#include <stdlib.h>

int main()
{
    unsigned long long int n,k;
    scanf("%llu %llu",&n,&k);
    unsigned long long int a[n],br[n*2+1],i,x;
    for (i=0;i<n*2+1;i++)
    {
        br[i]=0;
    }
    for (i=0;i<n;i++)
    {
        scanf("%llu",&a[i]);
        x=a[i];
        br[n+x]++;
    }
    printf("\n%llu\n",k);
    for (i=0;i<n*2+1;i++)
    {
        if(br[i]>=k)
        printf("%llu ",i-n);
    }
}