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

int main ()
{

    long N, K;
    scanf ("%ld%ld", &N, &K);

    long A[2*N+1];
    long t;

    for (long i=0; i<N; i++)
    {
        scanf ("%ld", &t);
        A[t+N]++;
    }

    t = 0;
    for (long i=0; i<N; i++)
        if (A[i]>=K)
            t++;
    
    printf ("%ld\n", t);
    for (long i=0; i<N; i++)
        if (A[i]>=K)
            printf ("%ld ", i-N);
    
    return 0;
}