#include <bits/stdc++.h>

using namespace std;

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

    vector <long long> v(2000001);
    long long n,k;  cin>>n>>k;

    for (long long i = 0; i<n; i++) {
         long long x; cin>>x;
         if (x>=0)
            v[x]++;
         else {
            x *= -1;
            v[x+1000000]++;
         }
    }

    long long count = 0;
    for (long long i = 0; i<2000001; i++)
        if (v[i] >= k) count++;
    cout<<count<<endl;

    vector <long long> c;
    for (long long i = 0; i<2000001; i++) {
        if (i <= 1000000 && v[i] >= k)
            c.push_back(i);
        else if (i > 1000000 && v[i] >= k) {
            c.push_back((i-1000000)*(-1));
        }
    }

    for (long long i = 0; i<c.size(); i++) cout<<c[i]<<" ";

    return 0;
}