using System;

namespace pikado
{
    class Program
    {
        static void Main(string[] args)
        {
            string l1 = Console.ReadLine();
            string[] l1Parts = l1.Split(" ");
            int n = Convert.ToInt32(l1Parts[0]);
            int k = Convert.ToInt32(l1Parts[1]);
            
            string l2 = Console.ReadLine();
            string[] l2Parts = l2.Split(" ");

            int pom = n + 1;
            int[] polja = new int[n + pom];
            for (int i = 0; i < n; i++)
            {
                int polje = Convert.ToInt32(l2Parts[i]);
                polja[polje + pom]++;
            }

            int zaZamenu = 0;
            string zaZamenuStr = "";
            for (int i = 0; i < polja.Length; i++)
            {
                if (polja[i] >= k)
                {
                    zaZamenu++;
                    zaZamenuStr += (i - pom) + " ";
                }
            }
            
            Console.WriteLine(zaZamenu);
            Console.WriteLine(zaZamenuStr.Trim());
        }
    }
}