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

namespace PrviZadatakLongLong
{
    class Program
    {
        static void Main(string[] args)
        {
            long  n = long.Parse(Console.ReadLine());
            long k = long.Parse(Console.ReadLine());
            long z;
            long br = 0;
            long[] a = new long[n];
            long[,] b = new long[2, n * 2 + 1];
            for (z = 0; z < n; z++)
            {
                a[z] = int.Parse(Console.ReadLine());
            }
            for (long i = 0, j = -n; i < n * 2 + 1 && j <= n; i++, j++)
            {
                b[0, i] = j;
                b[1, i] = k;
            }
            z = 0;
            while (z != n)
            {
                for (long i = 0; i < n * 2 + 1; i++)
                {
                    if (b[0, i] == a[z])
                    {
                        b[1, i]--;
                        if (b[1, i] == 0) br++;
                    }
                }
                z++;
            }
            Console.WriteLine(br);
            for (long i = 0; i < n * 2 + 1; i++)
            {
                if (b[1, i] <= 0) Console.Write(b[0, i] + " ");
            }
        }
    }
}