提示: 欢迎访问OurACM平台。
Problem 1664 Top K different numbers

Accept: 663    Submit: 1709
Time Limit: 1000 mSec    Memory Limit : 32768 KB

Problem Description

There are N numbers in an array. Now your question is to select the top K different numbers in the array. The top K different numbers are the largest K different numbers in the array. If there are less than K different numbers, just output “-1” instead.

Input

There are multiply test cases. For each test case, the first line are two integer N and K(1≤N≤10000, 1≤K≤N). In the second line, there are N integers which are separated by a space. It is guaranteed that the element in the array will fit within a 32-bit integer.

Output

For each test case, output the top K different numbers increasingly. Please separate the K numbers by a space. If there are less than K different numbers, just output “-1” instead.

Sample Input

2 1 1 2 3 2 1 1 2 3 3 1 1 2

Sample Output

2 1 2 -1

Source

FOJ月赛-2008年11月

Submit  Back  Status  Discuss