#include <bits/stdc++.h>

using namespace std;

int main()
{
    long int N,K;
    long int s=0;
    cin>>N>>K;
    long int a[1000006];
    for (long int i=1; i<=N; i++)
    {
        cin>>a[i];
    }
    long int b[2000012];
    for (long int i=1; i<=N; i++)
    {
        b[a[i]+N]=b[a[i]+N]+1;
    }
    for (long int i=0; i<=2*N; i++)
    {
        if (b[i]>=K)
        {
            s=s+1;
        }
    }
    cout<<s<<endl;
    for (long int i=0; i<=2*N; i++)
    {
        if (b[i]>=K)
        {
            cout<<i-N<<" ";
        }
    }
    return 0;
}