#include <bits/stdc++.h>
using namespace std;

int a[2000001] = {0};

int main()
{
    int n, k;
    cin >> n >> k;
    vector <int> b;
    int pom, res = 0;
    for(int i = 0; i < n; i++)
    {
        cin >> pom;
        if(pom <= 0)
        {
            a[abs(pom)]++;
            if(a[abs(pom)] == k)
            {
                res++;
                b.push_back(pom);
            }
        }
        else
        {
            a[n + pom]++;
            if(a[n + pom] == k)
            {
                res++;
                b.push_back(pom);
            }
        }
    }
    cout << res << "\n";
    for(int i = 0; i < b.size(); i++)
    {
        cout << b[i] << " ";
    }

}