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;
import java.io.PrintWriter;
import java.util.*;

public class SolutionC extends Thread {
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                                            InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

    private static final FastReader scanner = new FastReader();
    private static final PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        new Thread(null, new SolutionC(), "Main", 1 << 26).start();
    }

    public void run() {
        int t = scanner.nextInt();
        for (int i = 0; i < t; i++) {
            solve();
        }
        out.close();
    }

    private static void solve() {
        int n = scanner.nextInt();
        int k = scanner.nextInt();

        String s = scanner.next();
        char[] chars = s.toCharArray();

        if (n % k != 0) {
            out.println(-1);
            return;
        }

        int[] distr = new int[26];
        for (char c: s.toCharArray()) {
            distr[c-'a']++;
        }

        boolean allDivisible = true;
        for (int i = 0; i < 26; i++) {
            if (distr[i] % k != 0) {
                allDivisible = false;
                break;
            }
        }

        if (allDivisible) {
            out.println(s);
            return;
        }

        for (int i = n-1; i>=0; i--) {
            int amountToFillUp = 0;
            distr[s.charAt(i)-'a']--;
            for (int j = 0; j<26;j++) {
                amountToFillUp += (k - (distr[j] % k)) % k;
            }
            for (char c = (char) (s.charAt(i)+1); c <= 'z'; c++) {
                int tmpAmountToFillUp = amountToFillUp;
                if (distr[c-'a'] % k != 0) {
                    tmpAmountToFillUp--;
                } else {
                    tmpAmountToFillUp += k-1;
                }
                if (tmpAmountToFillUp <= n - i - 1) {
                    //found solution
                    chars[i] = c;
                    distr[c-'a']++;

                    int pointer = 25;

                    for (int j = n-1; j > i; j--) {
                        while (pointer >= 0 && distr[pointer] % k == 0) {
                            pointer--;
                        }

                        if (pointer < 0) {
                            chars[j] = 'a';
                        } else {
                            chars[j] = (char) (pointer + 'a');
                            distr[pointer]++;
                        }
                    }
                    StringBuilder t = new StringBuilder();
                    for (int j = 0; j < n; j++) {
                        t.append(chars[j]);
                    }
                    out.println(t);
                    return;
                }
            }
        }
        out.println("found nothn");
    }

    //REMINDERS:
    //- CHECK FOR INTEGER-OVERFLOW BEFORE SUBMITTING

    //- CAN U BRUTEFORCE OVER SOMETHING, TO MAKE IT EASIER TO CALCULATE THE SOLUTION
}