import java.util.Scanner;
public class Pikado {
     private static Scanner input=new Scanner (System.in);
	public static void main(String[] args) {
	    int n=input.nextInt();
	    int k=input.nextInt();
	    int []a=new int[2*n+1];
	    for(int j=0;j<2*n+1;j++) {
	    	a[j]=0;
	    }
	    int i=0;
	    while (i<n) {
	       int b=input.nextInt();
	       if((b<=n)&&(b>=-n)) {
	    	   i++;
	    	   a[b+n]++;
	       }else {
	    	   System.out.println("vrednost b mora da bude izmedju -n i n");
	       }
	    }
	    int l=0;
        for(int s=0;s<2*n+1;s++) {
        	if(a[s]>=k) {
        		l++;
        	}
        }
        System.out.println(l);
        for(int s=0;s<2*n+1;s++) {
        	if(a[s]>=k) {
        		System.out.print(s-n);
        		System.out.print(" ");
        	}
        }
	}

}