#include <iostream>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);

    int N, K;
    cin >> N >> K;

    int *a = new int[2*N+1] {};
    int l;
    for (int i = 0; i < N; ++i)
    {
        cin >> l;
        a[l+N]++;
    }

    int brojac(0);
    for (int i = 0; i < 2*N+1; ++i)
        if (a[i] >= K) brojac++;

    cout << brojac << '\n';

    for (int i = 0; i < 2*N+1; ++i)
        if (a[i] >= K) cout << i-N << " ";

    return 0;
}