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

namespace _1.pikado
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] ulaz1 = Console.ReadLine().Split();
            string[] ulaz2 = Console.ReadLine().Split();
            int n = Convert.ToInt32(ulaz1[0]);
            int k = Convert.ToInt32(ulaz1[1]);
            Dictionary<int, int> brojac = new Dictionary<int, int>();
            foreach(string b in ulaz2)
            {
                int a = Convert.ToInt32(b);
                if (!brojac.ContainsKey(a))
                {
                    brojac.Add(a, 0);
                }
                brojac[a]++;
            }
            string izlaz = "";
            int count = 0;
            foreach (KeyValuePair<int, int> a in brojac)
            {
                if (a.Value >= k)
                {
                    izlaz += a.Key.ToString() + " ";
                    count++;
                }
            }
            Console.WriteLine(count);
            if(count != 0)
            Console.WriteLine(izlaz);
        }
    }
}