#include <iostream>

using namespace std;

int main()
{
    long n,k;
    cin >> n >> k;
    long a[2*n+1],br=0;
    for(long i=0;i<=2*n;i++)a[i]=0;
    while(br<n)
    {
        long i;
        cin >> i;
        a[i+n]++;
        br++;
    }
    br=0;
    for(long i=0;i<=2*n;i++)
    {
        if(a[i]>=k)br++;
    }
    cout << br << endl;
    for(long i=0;i<=2*n;i++)
    {
        if(a[i]>=k) cout << i-n << " ";
    }
}