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

int main()
{
	long long n, k;
	scanf("%lld%lld", &n, &k);
	long long a[1000001] = { };
	long long b[1000001] = { };
	long long zero = 0;
	vector<long long> vec;
	
	for(long long i = 0; i < n; i++)
	{
		long long x;
		scanf("%lld", &x);
		if(x == 0 && ++zero == k) vec.push_back(0);
		else if(x < 0 && ++a[-x] == k) vec.push_back(x);
		else if(x > 0 && ++b[x] == k) vec.push_back(x);
	}
	
	printf("%lld\n", (long long)vec.size());
	for(vector<long long>::iterator it = vec.begin(); it != vec.end(); it++)
		printf("%lld ", (*it));
}