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

namespace ConsoleApplication26
{
    class Program
    {
        struct meta
        {
            public long broj;
            public long koriscenje;

        }
        static void Main(string[] args)
        {
            string[] l = Console.ReadLine().Split(' ');
            long n = Convert.ToInt64(l[0]);
            long k = Convert.ToInt64(l[1]);
            long[] d = new long[n];
            long b = -n;
            string x = "";
            long br = 0;
            Random rnd = new Random();
            meta[] a = new meta[2 * n+1];
            for (long i = 0; i < n*2+1; i++)
            {
                a[i].broj = b;
                a[i].koriscenje = k;
                b++;
                
            }
                string[] m = Console.ReadLine().Split(' ');
                for (long i = 0; i < n; i++)
                {
                    d[i] = Convert.ToInt64(m[i]);
                    for (long j = 0; j < 2 * n + 1; j++)
                    {
                        if (a[j].broj == d[i])
                        {
                            a[j].koriscenje--;
                            if (a[j].koriscenje == 0)
                            {
                                br++;
                                x = x + a[j].broj.ToString() + ' ';
                            }
                        }
                    }
                }
            Console.WriteLine(br.ToString());
            Console.WriteLine(x); 
        }
    }
}