12
12 3
zazasqzqsasq
1 1
z
1 1
a
15 4
abccbaabccbazaa
16 8
cadjfdsljfdkljds
6 2
baazaa
6 3
bosszb
6 1
qwerty
7 7
daaaaaa
14 2
acabcbdeffewzd
18 6
zzzzzzzzzzzzyyyyyz
9 4
aabaabbbc

zazasqzqsasq
z
a
-1
cbbbbbbbbccccccc
baazbz
bpbbpp
qwerty
ddddddd
acabcbdeffexdx
zzzzzzzzzzzzzzzzzz
-1

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main
{
    public static void main(String[] args)throws IOException {
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        int test = Integer.parseInt(bufferedReader.readLine());
        while ( test -- > 0 )
        {
            String[] s = bufferedReader.readLine().split(" ");
            int n = Integer.parseInt(s[0]),k = Integer.parseInt(s[1]);
            String s1 = bufferedReader.readLine();
            if(n % k == 1)
            {
                System.out.println(-1);
                continue;
            }
            int[] freq = new int[27];
            for( int i = 0 ; i < s1.length() ; i++ ) freq[s1.charAt(i) - 'a']++;
            for ( int i = 0 ; i < 25 ; i++ )
            {
                freq[i+1] += freq[i] % k;
                freq[i] -= freq[i] % k;
            }
            for( int i = 25 ; i >= 0 ; i--)
            {
                if( freq[i] > 0 ) {
                    for( int j = 0 ; j < freq[i] ; j++)
                    System.out.print((char)(i+'a'));
                }
            }
            System.out.println();
        }
    }
}