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

namespace _1_Pikado
{
    class Program
    {
        static void Main(string[] args)
        {
            string s1 = Console.ReadLine();
            string s2 = Console.ReadLine();
            string[] s = s1.Split(' ');
            int N = Convert.ToInt32(s[0]);
            int K = Convert.ToInt32(s[1]);
            s = s2.Split(' ');
            int[] h = new int[2 * N + 1];
            int hh = Convert.ToInt32(0);
            for (int i = 0; i < s.Length; i++)
            {
                h[Convert.ToInt32(s[i]) + N]++;
            }
            for (int i = 0; i < h.Length; i++)
            {
                if (h[i] >= K)
                {
                    hh++;
                }
            }
            Console.WriteLine(hh);
            for (int i = 0; i < h.Length; i++)
            {
                if (h[i] >= K)
                {
                    Console.Write(i - N + " ");
                }
            }
        }
    }
}