Character Distance
题号:NC229301
时间限制:C/C++/Rust/Pascal 2秒,其他语言4秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

You are given an array a of length n and you need to rearrange the array to satisfy that there exists at least one number x that appears at least once in the array and for each pair that satisfy .

If there is no such array exist, please output -1. Otherwise, output the array rearranged with the minimum lexicographical order.

输入描述:

The first line contains one integer , denoting the number of test cases.

Each test case contains two lines.

The first line contains two integers denoting the length of array a and the minimum distance defined in the statement above.

The second line contains n integers, the integer denotes the number of array a.

It is guaranteed that the sum of n in all test cases does not exceed .

输出描述:

For each test case output one line.

If there is no solution output -1 in one line, otherwise output n integers as the solution array with minimum lexicographical order.
示例1

输入

复制
4
4 3
1 2 1 2
4 4
1 1 2 2
6 3
3 3 2 2 1 1
7 3
1 1 2 2 2 3 3

输出

复制
1 2 2 1
-1
1 1 2 3 3 2
1 1 2 3 2 2 3