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

namespace ConsoleApp21
{
    class Program
    {
        
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            int n = int.Parse(s.Split(' ')[0]);
            int k = int.Parse(s.Split(' ')[1]);
            int[] niz = new int[n];
            int[,] arr = new int[n + 1, 4];
            string r = Console.ReadLine();
            for (int i = 0; i < n; i++)
            {
                niz[i] = int.Parse(r.Split(' ')[i]);
            }
            for (int i = 0; i < n; i++)
            {
                arr[i, 2] = 0;
                arr[i, 3] = 0;
            }
           
            for (int i = 0; i < n; i++)
            {
                if (Math.Abs(niz[i]) <= n)
                {
                    if (niz[i] > 0 ) arr[niz[i], 0]++;
                    else  arr[Math.Abs(niz[i]), 1]++;

                }
            }
            
            
                for (int i = 0; i < n; i++)
                {
                
                    if (niz[i] > 0 && arr[Math.Abs(niz[i]),2] == 0)
                        {
                        if (arr[niz[i], 0] >= k) Console.Write(niz[i] + " ");
                        arr[Math.Abs(niz[i]), 2] = 1;
                        }
                    if (niz[i] <= 0 && arr[Math.Abs(niz[i]), 3] == 0)
                        {
                        if (arr[Math.Abs(niz[i]), 1] >= k) Console.Write( niz[i] + " ");
                        arr[Math.Abs(niz[i]), 3] = 1;
                }
                    
                }
                
        }
    }
}