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.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        for (int i = 0; i < t; i++) {
            int n = sc.nextInt();
            int k = sc.nextInt();
            char[] str = sc.next().toCharArray();
            if (n % k != 0) {
                System.out.println(-1);
                continue;
            }
            int[] cnt = new int[26];
            for (char c : str) {
                cnt[c - 97]++;
            }
            int sum = 0;
            for (int c : cnt) {
                if (c % k != 0) {
                    sum += k - (c % k);
                }
            }
            if (sum == 0) {
                System.out.println(str);
                continue;
            }
            boolean found = false;
            String cand = null;
            int j;
            int jj = 0;
            for (j = str.length - 1; j > 0; j--) {
                sum = sum - (k - cnt[str[j] - 97] % k) % k + (k - (cnt[str[j] - 97] - 1) % k) % k;
                cnt[str[j] - 97]--;
                for (jj = (int) str[j] - 97 + 1; jj <= 25; jj++) {
                    int tmpSum = sum - (k - cnt[jj] % k) % k + (k - (cnt[jj] + 1) % k) % k;
                    cnt[jj]++;
                    cand = findStr(j + 1, tmpSum, cnt, k, n);
                    if (cand != null) {
                        found = true;
                        break;
                    }
                    cnt[jj]--;
                }
                if (found) break;
            }
            if (!found) {
                System.out.println("-1");
            } else {
                StringBuilder sb = new StringBuilder();
                for (int jjj = 0; jjj < j; jjj++) {
                    sb.append(str[jjj]);
                }
                sb.append((char) (jj + 97));
                sb.append(cand);
                System.out.println(sb);
            }
        }
    }

    private static String findStr(int prefLength, int sum, int[] cnt, int k, int n) {
        if (n - prefLength < sum || (n - prefLength - sum) % k != 0) return null;
        StringBuilder result = new StringBuilder();
        for (int i = 25; i >= 0; i--) {
            if (cnt[i] % k == 0) continue;
            result.append(
                    String.valueOf((char) (i + 97))
                            .repeat(k - cnt[i] % k)
            );
        }
        result.append(
                String.valueOf('a')
                        .repeat(n - prefLength - sum)
        );
        return result.reverse().toString();
    }

}
