import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String str1 = scanner.nextLine();
String str2 = scanner.nextLine();
//获取第一行的 n 和 k
int n = Integer.parseInt(str1.split(" ")[0]);
int k = Integer.parseInt(str1.split(" ")[1]);
String[] strs = str2.split(" ");
int[] arr = new int[strs.length];
for(int i = 0 ; i < arr.length;i ++){
arr[i] = Integer.parseInt(strs[i]);
}
int count = n/k;
HashMap<Integer,Integer> hashMap = new HashMap<>();
for (int i = 0;i < arr.length;i ++){
if (!hashMap.containsKey(arr[i])){
hashMap.put(arr[i],1);
}else {
hashMap.put(arr[i],(hashMap.get(arr[i]) + 1));
}
}
ArrayList<Integer> list = new ArrayList<>();
Set<Map.Entry<Integer, Integer>> entries = hashMap.entrySet();
for (Map.Entry<Integer, Integer> entry : entries) {
if (entry.getValue() > count){
list.add(entry.getKey());
}
}
if (list.size() <= 0){
System.out.println(-1);
}else {
for (Integer integer : list) {
System.out.print(integer + " ");
}
}
}
}