#include <iostream>

using namespace std;

int niz[2000001] = {0};

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