#include <iostream>

using namespace std;

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