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

namespace Prog_IIk_p
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            int n = Convert.ToInt32(s[0]);
            int k = Convert.ToInt32(s[1]);

            string[] g = Console.ReadLine().Split();
            int[] data = new int[2 * n + 1];
            int[] data2 = new int[2 * n + 1];
            int i_data2 = 0;
            for(int i=0;i<n;i++)
            {
                int p = Convert.ToInt32(g[i]);
                if (p < 0)
                    p =-p+n;
                data[p]++;
            }
            for(int i=0;i<2*n+1;i++)
            {
                if(data[i]>=k)
                {
                    if (i > n)
                        data2[i_data2] = -(i - n);
                    else
                        data2[i_data2] = i;
                    i_data2++;
                }
            }
            Console.WriteLine(i_data2);
            for (int i = 0; i < i_data2; i++)
                Console.Write(data2[i] + " ");

        }
    }
}