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 line = Console.ReadLine();
            var data = line.Split(' ');
            int n = int.Parse(data[0]);
            int k = int.Parse(data[1]);
            line = Console.ReadLine();
            data = line.Split(' ');
            int[] niz = new int[2 * n + 1];
            int t = 0;
            for (int i = 0; i < n; i++) niz[int.Parse(data[i]) + n]++;
            for (int i = 0; i < 2 * n + 1; i++)
            {
                if (niz[i] >= k) t++;
            }
            Console.WriteLine(t);
            for (int i = 0; i < 2 * n + 1; i++)
            {
                if (niz[i] >= k) Console.Write((i-n)+" ");
            }
        }
    }
}