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[] x = Console.ReadLine().Split();
            int n = int.Parse(x[0]), k = int.Parse(x[1]);
            int[] niz = new int[n];
            int[] niz2 = new int[n * 2 + 1];
            List<int> lista = new List<int>();
            int br = 0;
            x = Console.ReadLine().Split();
            for (int i = 0; i < n; i++)
                niz[i] = int.Parse(x[i]);
            foreach (var d in niz)
                niz2[d + n]++;
            for (int i = 0; i < niz2.Length; i++)
            {
                if(niz2[i]>=k)
                {
                    br++;
                    lista.Add(i - n);
                }
            }
            Console.WriteLine(br);
            foreach (var d in lista)
            {
                Console.Write(d + " ");
            }
            Console.WriteLine();
        }
    }
}