using System;

namespace Pikado
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            int n = int.Parse(s[0]);
            int k = int.Parse(s[1]);

            int[] p = new int[2 * n + 1];

            s = Console.ReadLine().Split();
            int c = 0;
            for (int i = 0; i < n; i++)
            {
                int j = int.Parse(s[i]) + n;
                p[j]++;
                if (p[j] == k)
                {
                    c++;
                }
            }

            Console.WriteLine(c);
            for (int i = 0; i < 2 * n + 1; i++)
            {
                if (p[i] >= k)
                {
                    Console.Write(i - n + " ");
                }
            }
        }
    }
}