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

using namespace std;

int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);

long n,k;
cin >> n >> k;


long *kk=(long*)calloc((2*n+1),sizeof(long));



for (long i=0;i<n;i++)
{
    long x;
    cin >> x;
    kk[x+n]++;
}

long s=0;

for (long i=0;i<2*n+1;i++)
if (kk[i]>=k) s++;

cout << s <<"\n";
for (long i=0;i<2*n+1;i++)
    if (kk[i]>=k) cout << i-n << " ";

return 0;
}