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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int n, k;
            string[] fr = Console.ReadLine().Split();
            n = int.Parse(fr[0]);
            k = int.Parse(fr[1]);
            string[] sc = Console.ReadLine().Split();
            int bri = 0;
            int ulb = 0;
            int arb = 0;
            for (int i = -n; i <= n; i++)
            {
                for (int j = 0; j < n; j++)
                {
                    if (int.Parse(sc[j]) == i)
                    {
                        bri++;
                    }
                }
                if (bri >= k)
                {
                    ulb++;
                }
                bri = 0;
            }
            int[] arr = new int[ulb];
            for (int i = -n; i <= n; i++)
            {
                for (int j = 0; j < n; j++)
                {
                    if (int.Parse(sc[j]) == i)
                    {
                        bri++;
                    }
                }
                if (bri >= k)
                {
                    arr[arb] = i;
                    arb++;
                }
                bri = 0;
            }
            Console.WriteLine(ulb);
            Console.Write(arr[0] + " ");
            for (int i = 1; i < ulb - 1; i++)
            {
                Console.Write(arr[i] + " ");
            }
            Console.Write(arr[ulb - 1]);
        }
    }
}