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

namespace ConsoleApp4
{
    class Program
    {
        static void Main(string[] args)
        {
            var line = Console.ReadLine();
            var data = line.Split(' ');
            int n = int.Parse(data[0]);
            int k = int.Parse(data[1]);
            
            line = Console.ReadLine();
            data = line.Split(' ');

            int[] a = new int[2 * n + 1];
            for (int i = 0; i < 2 * n + 1; i++)
                a[i] = 0;
            for (int i = 0; i < data.Length; i++)
            {
                a[int.Parse(data[i]) + n]++;
            }


            List<int> zaZamenu = new List<int>();
            for (int i = 0; i < 2 * n + 1; i++)
            {
                if (a[i]>=k)
                {
                    zaZamenu.Add(i - n);
                }
            }
            Console.WriteLine(zaZamenu.Count);
            foreach (int polje in zaZamenu)
                Console.Write("{0} ",polje);

        }
    }
}