#include <bits/stdc++.h>
using namespace std;

int main()
{
    long N,k,x;
    long br=0;

    cin >> N >> k;

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

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

    }

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

    cout << br << endl;

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


    return 0;
}