#include <iostream>
#include<bits/stdc++.h>
using namespace std;
vector<int> v;
int brneg[1000010],brpoz[1000010];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n,i,k,a;
    cin >> n >> k;
    for(i=0;i<n;i++)
    {
        cin >> a;
        if(a<0)
        {
            brneg[-a]++;
            if(brneg[-a]==k)
                v.push_back(a);
        }
        else
        {
            brpoz[a]++;
            if(brpoz[a]==k)
                v.push_back(a);
        }
    }
    cout << v.size() << endl;
    for(i=0;i<v.size();i++)
        cout << v[i] << " ";
    //cout << "Hello world!" << endl;
    return 0;
}