#include <stdio.h>

long int a[2000001];

int main()
{
    long int n,k,x,c=0;
    scanf("%ld %ld",&n,&k);

    for(long int i=0;i<n;i++){
        scanf("%ld",&x);
        a[x+n]++;
    }

    for(long int i=0;i<2*n+1;i++){
           if(a[i]>=k){
                c++;
           }
    }
    printf("%ld\n",c);
    for(long int i=0;i<2*n+1;i++){
           if(a[i]>=k){
            printf("%ld ",i-n);
           }
    }
    return 0;
}