#include <iostream>
#include <math.h>

using namespace std;

int main() {
	int poz[1000000], neg[1000000], n, k, x, br = 0;
	cin>>n>>k;
	for (int i = 0; i < n; i++) {
		poz[i] = 0;
		neg[i] = 0;
	}
	for (int i = 0; i < n; i++) {
		cin>>x;
		if (x >= 0) poz[x] += 1;
		else neg[abs(x) - 1] += 1;
	}
	for (int i = 0; i < n; i++) {
		br += poz[i] / k;
		br += neg[i] / k;
	}
	cout<<br<<endl;
	for (int i = 0; i < n; i++) {
		if (poz[i] >= k) cout<<i<<" ";
		if (neg[i] >= k) cout<<-i - 1<<" "; 
	}
	return 0;
}