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

namespace PIKADO
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            string[] s1 = s.Split(' ');
            int n = int.Parse(s1[0]);
            int k = int.Parse(s1[1]);
            int[] a = new int[n];
            int[] b = new int[2 * n + 1];
            int br = 0;
            List<int> l = new List<int>();
            s = Console.ReadLine();
            s1 = s.Split(' ');
            for(int i=0;i<n;i++)
            {
                a[i] = int.Parse(s1[i]);
                b[a[i] + n]++;
            }
            for(int i=0;i<2*n+1;i++)
            {
                if (b[i] >= k)
                {
                    br++;
                    l.Add(i - n);
                }
            }
            Console.WriteLine(br);

            if (br > 0)
            {
                Console.Write(l[0]);
                for (int i = 1; i < l.Count(); i++)
                {
                    Console.Write(" " + l[i]);
                }
            }
        }
    }
}