Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Equal Values

Limits 2s, 512 MB

You have an array containing N elements. In one move you can either increase or decrease the value of an element by K.

Your task is to make all the values of the array equal. If it is possible, print the minimum number of moves required to do this. Otherwise print “Impossible”.

Input

The first will contain an integer T denoting the number of test cases.

For every case, the first line contains two integers N and K.

The next line contains N integers denoting the elements of the array.

Constraints:

1 ≤ T ≤ 100

1 ≤ N ≤ 1000

0 ≤ K ≤ 1000000

0 ≤ Array Elements Value ≤ 10000000

Output

For each test case, if it is possible to make all the values equal, print the minimum number of moves required. Otherwise print “Impossible”.

Samples

InputOutput
3
3 1
2 1 1
4 2
9 1 7 3
4 2
2 4 6 7
1
6
Impossible

Discussion