#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, k,broj, brojac=0, i;

    cin>>n>>k;

    int polje[2*n+1];
    memset(polje, 0, sizeof(polje));
    int niz[n];
    for(i=0; i<n; i++)
    {
        cin>>broj;
        polje[broj+n]++;
    }

    for(i=0; i<(2*n+1); i++)
    {
        if(polje[i]>=k)
        {
            brojac++;
        }
    }
    cout<<brojac<<endl;

    for(i=0; i<(2*n+1); i++)
    {
        if(polje[i]>=k)
        {
            cout<<i-n<<" ";
        }
    }
    cout<<endl;

    return 0;
}