#include <iostream>

using namespace std;

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

    return 0;
}