using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace petlja2
{
	class Program
	{
		static void Main(string[] args)
		{
			string[] unos1, unos2;
			unos1 = Console.ReadLine().Split(' ');
			int n = Convert.ToInt32(unos1[0]);
			int k = int.Parse(unos1[1]), br, br2 = 0;
			List<int> polja = new List<int>();
			List<int> pogodjenaPolja = new List<int>();
			List<int> indeksi = new List<int>();
			for (int i = n; i >= -n; i--)
			{
				polja.Add(i);
			}
			unos2 = Console.ReadLine().Split(' ');
			for (int i = 0; i < n; i++)
			{
				pogodjenaPolja.Add(Convert.ToInt32(unos2[i]));
			}
			for (int i = 0; i < polja.Count; i++)
			{
				br = 0;
				for (int j = 0; j < pogodjenaPolja.Count; j++)
				{
					if (polja[i] == pogodjenaPolja[j])
					{
						br++;
					}
				}
				if (br >= k)
				{
					br2++;
					indeksi.Add(i);
				}
			}
			Console.WriteLine(br2);
			for (int i = 0; i < br2; i++)
			{
				Console.Write(polja[indeksi[i]] + " ");
			}
		}
	}
}