#include <iostream>
#include <vector>

using namespace std;

static int neg[1000000], pos[1000000];

int main(void)
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n, k, p, c = 0;
    vector<int> r;
    cin >> n >> k;

    for( int i = 0; i < n; i++ )
    {
        cin >> p;
        if( p >= 0 )
            pos[p]++;
        else
            neg[(-p)]++;
    }
    for( int i = 0; i < n; i++ )
    {
        if( pos[i] >= k )
        {
            c++;
            r.push_back(i);
        }
        if( neg[i] >= k )
        {
            c++;
            r.push_back(-i);
        }
    }
    cout << c << endl;
    for( int i = 0; i < c; i++ )
        cout << r[i] << " ";

    return 0;
}