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

int main()
{
	int n;
	int k;
	vector <int> B;
	int p;
	int br = 0;


	cin >> n >> k;
	vector <int> R(2*n+1);
	fill( R.begin(), R.end(), 0 );
	for ( int i = 0; i < n; i++ )
	{
		cin >> p;
		if ( p > -1 )
		{
			R[p]++; 
		}
		else
		{
			R[abs(p)+n]++;
		}
	}

	for ( int i = 0; i < R.size(); i++ )
	{
		if ( R[i] >= k )
		{
			br++;
			if ( i < n )
			{
				B.push_back(i);
			}
			else
			{
				B.push_back(n-i);
			}
		}
	}

	cout << br << endl;
	for ( int g = 0; g < B.size(); g++ )
	{
		cout << B[g] << " ";
	} 

	return 0;
}