#include <bits/stdc++.h>

using namespace std;

int a[1000000], a1[1000000], b[1000000];

int main()
{
    int n, k, bPolja = 0, br; cin>>n>>k;

    for(int j = 0; j < n; j++) { a[j] = 0; a1[j] = 0;}

    for(int i = 0; i < n; i++)
    {
        cin>>br;
        if(br < 0) a1[-br]++;
        else a[br]++;
        
        if((br >= 0 && a[br] == k) || (br < 0 && a1[-br] == k))
        {
            bPolja++;
            b[bPolja-1] = br;
        }
    }

    cout<<bPolja<<endl;

    for(int j = 0; j < bPolja; j++) cout<<b[j]<<" ";

    return 0;
}