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.util.ArrayList;
import java.util.Scanner;

public class NewClass2 {

    public static String rev(String str) {
        StringBuilder sb = new StringBuilder(str);
        sb.reverse();
        return sb.toString();
    }

    static boolean check(String s) {
        int c = 0;
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) == '0' || s.charAt(i) == '1' || s.charAt(i) == '2' || s.charAt(i) == '5' || s.charAt(i) == '8') {
                ++c;
            }
        }
        return c == s.length();
    }

    public static void main(String args[]) {
        Scanner scan = new Scanner(System.in);

        int t = scan.nextInt();
        StringBuilder sb = new StringBuilder();

        k:
        while (t-- > 0) {
            int n = scan.nextInt();
            int k = scan.nextInt();
            String s = scan.next();
            int[] a = new int[26];
            for (int i = 0; i < n; i++) {
                ++a[s.charAt(i) - 'a'];
            }
            if (k == 1) {
                sb.append(s + "\n");
                continue k;
            }

            for (int i = n - 1; i >= 0; i--) {
                --a[s.charAt(i) - 'a'];
                int c = 0;
                for (int j = 0; j < 26; j++) {
                    if (a[j] % k != 0) {
                        c += (k - a[j] % k);
                    }
                }
                int p = c;
                for (int j = s.charAt(i) - 'a' + 1; j < 26; j++) {
                    if (a[j] % k != 0) {
                        c -= 1;
                    } else {
                        c += (k - 1);

                    }
                    if (n - i - 1 >= c && ((n - i - 1) - c) % k == 0) {

                        for (int l = 0; l < i; l++) {
                            sb.append(s.charAt(l));
                        }
                        ++a[j];
                        a[j] = a[j] % k;
                        sb.append((char) (j + 'a'));
                        for (int l = 0; l < (n - i - 1) - c; l++) {
                            sb.append('a');
                        }
                        for (int l = 0; l < 26; l++) {
                            int w = (k - a[l] % k) % k;

                            for (int m = 0; m < w; m++) {
                                sb.append((char) ('a' + l));
                            }
                        }
                        sb.append("\n");
                        continue k;

                    }
                    c = p;
                }

            }
            sb.append("-1\n");

        }
        System.out.println(sb);

    }
}
