#include <iostream>

using namespace std;

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