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

namespace ConsoleApplication5
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = new string[2];
            str = Console.ReadLine().Split(' ');
            int n = int.Parse(str[0]);
            int k = int.Parse(str[1]);
            int[] a = new int[n];
            string[] str1 = new string[n];
            str1 = Console.ReadLine().Split(' ');
            for (int i = 0; i < n; i++) a[i] = int.Parse(str1[i]);
            int b = 0;
            string str2="";
            for (int i=-n; i<= n;i++)
            {
                int b1 = 0;
                for (int j=0; j< n; j++) if (a[j] == i) b1++;
                if (b1>=k)
                {
                    b++;
                    str2 = str2 + i.ToString() + " ";
                }
            }
            Console.WriteLine(b);
            Console.WriteLine(str2);
        }
    }
}