#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;

    int niz[2*n+1];
    vector<int> rez;

    for (int i = 0; i < 2*n+1; i++) niz[i] = 0;

    for (int i = 0; i < n; i++)
    {
        int a;
        cin >> a;

        niz[a+n]++;
    }

    for (int i = 0; i < 2*n+1; i++)
    {
        if (niz[i] >= k)
        {
            rez.push_back(i-n);
        }
    }

    cout << rez.size() << endl;

    for (int i = 0; i < (int)rez.size(); i++)
    {
        cout << rez[i] << " ";
    }
    cout << endl;

    return 0;
}