#include <iostream>

using namespace std;

int main()

{
 long long n,k,i,j=0,br=0,x;

 scanf("%lld%lld",&n,&k);

 long long a[2*n+1],b[2*n+1];

 for (i=0;i<2*n+1;i++)
   {
    a[i]=0;
    b[i]=0;
   }

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

  for (i=0;i<2*n+1;i++)
  {
   if (a[i]!=0)
   if (a[i]>=k)
   {
    br++;
    b[j]=i-n;
    j++;
   }
  }

  printf("%lld\n",br);
  for (i=0;i<j;i++)
    printf("%lld\n",b[i]);
    
}