#include <bits/stdc++.h>

using namespace std;

#define int ll
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pi> vp;
typedef vector<pl> vpl;

vi cnt(300000, 0);

signed main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(nullptr); 
    cout.tie(nullptr); 
    cerr.tie(nullptr);    

    int n, k;
    cin >> n >> k;

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

        ++cnt[x + n];
    }

    vi sol;
    for (int i = 0; i <= 2 * n; ++i){
        if (cnt[i] >= k){
            sol.push_back(i - n);
        }
    }

    int res = sol.size();
    cout << res << '\n';
    for (auto& i : sol)
        cout << i << ' ';
    cout << '\n';
}