#include <bits/stdc++.h>

using namespace std;
long long a[2000001],b[2000001],niz[2000001],ispis[2000001];

int main ()
{
  long long n, k;
  cin >> n >> k;
  long long x = -n;
  long long s = 0;
  for (int i = 1; i <= 2 * n + 1; i++)
    {
      niz[i] = x;
      b[i] = 0;
      x++;
    }
  for (int i = 1; i <= n; i++)
    cin >> a[i];


  for (int i = 1; i <= 2 * n + 1; i++)
    {
      for (int j = 1; j <= n; j++)
	{
	  if (niz[i] == a[j])
	    b[i]++;
	}
    }
  for (int i = 1; i <= 2 * n + 1; i++)
    if (b[i] >= k)
      {
	s++;
	ispis[s] = niz[i];
      }
  cout << s << endl;
  for (int i = 1; i <= s; i++)
    cout << ispis[i]<<" ";
  return 0;
}