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

public class C {


    public static int[] calcStat(char[] chars) {
        int[] result = new int[26];
        for (Character c: chars) {
            result[c - 'a'] ++;
        }
        return result;
    }

    public static boolean canSolve(int[] stat, int dist, int idx, char c, int n, int k) {
        int cNum = c - 'a';

        int oldDist = (k - stat[cNum]) % k;
        int newDist = (k - stat[cNum] - 1) % k;

        return dist + newDist - oldDist <= n - idx - 1;
    }

    public static int add(int[] stat, char c, int amount, int k) {
        int cNum = c - 'a';

        int oldDist = (k - stat[cNum]) % k;
        stat[cNum] = (stat[cNum] + amount + k) % k;
        int newDist = (k - stat[cNum]) % k;

        return newDist - oldDist;
    }

    public static String solve(String s, int k, int n) {

        // 1. Calc stat
        char[] chars = new char[n];
        for (int i = 0; i < n; ++i) {
            if (i < s.length())
                chars[i] = s.charAt(i);
            else
                chars[i] = 'a';
        }

        int[] stat = calcStat(chars);

        int dist = 0;
        for (int i = 0; i < stat.length; ++i) {
            stat[i] = stat[i] % k;
            dist += (k - stat[i]) % k;
        }

        // 2. Check the string is the answer or there is no answer
        if (dist == 0)
            return new String(chars);

        if (n % k != 0)
            return "-1";

        // 3. Move left
        int idx = n -1;
        boolean found = false;
        while (idx >= 0) {
//            if (idx == 0) {
//                System.out.println(stat);
//                System.out.println(dist);
//                System.out.println(chars);
//            }


            int delta = add(stat, chars[idx], -1, k);
            dist += delta;
            //System.out.println("delta: " + delta);

            for (char c = chars[idx]; c < 'z'; c++) {
                c = ++c;
                //System.out.println(idx + ": " + c);
                if (canSolve(stat, dist, idx, c, n, k)) {
                    found = true;
                    //System.out.println("Found: " + idx + ": " + c);

                    chars[idx] = c;
                    delta = add(stat, c, +1, k);
                    dist += delta;

                    break;
                }
            }
            if (found)
                break;
            idx -= 1;
        }
        if (!found)
            return "-1";

        // 4. Move right
        for (idx = idx + 1; idx < n; idx++) {
            for (char c = 'a'; c <= 'z'; c++) {
                if (canSolve(stat, dist, idx, c, n, k)) {
                    chars[idx] = c;
                    int delta = add(stat, c, +1, k);
                    dist += delta;
                    break;
                }
            }
        }

        return new String(chars);
    }


    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();
            sc.nextLine();
            String s = sc.nextLine();
            if (s.length() > n)
                s = s.substring(0, n);

            String ans = solve(s, k, n);

            System.out.println(ans);
        }
    }
}
