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

/*
polyakoff
*/

public class Main {

    static FastReader in;
    static PrintWriter out;
    static Random rand = new Random();
    static final int oo = (int) 1e9 + 10;
    static final long OO = (long) 2e18 + 10;
    static final int MOD = (int) 1e9 + 7;
    static final int N = (int) 2e5 + 10;

    static void solve() {
        int n = in.nextInt();
        int k = in.nextInt();
        char[] s = in.next().toCharArray();

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

        int todo = 0;
        int[] cnt = new int[26];
        for (int i = 0; i < n; i++) {
            int delta;
            if (cnt[s[i] - 'a'] % k == 0)
                delta = k - 1;
            else
                delta = -1;
            if (todo + delta > n - 1 - i) {
                // bad
                while (true) {
                    for (char c = (char) (s[i] + 1); c <= 'z'; c++) {
                        if (cnt[c - 'a'] % k == 0)
                            delta = k - 1;
                        else
                            delta = -1;
                        if (todo + delta <= n - 1 - i) {
                            todo += delta;
                            s[i] = c;
                            cnt[s[i] - 'a']++;
                            for (int j = i + 1; j < n; j++) {
                                for (char c2 = 'a'; c2 <= 'z'; c2++) {
                                    if (cnt[c2 - 'a'] % k == 0)
                                        delta += k - 1;
                                    else
                                        delta = -1;
                                    if (todo + delta <= n - 1 - j) {
                                        todo += delta;
                                        s[j] = c2;
                                        cnt[s[j] - 'a']++;
                                        break;
                                    }
                                }
                            }
                            for (int j = 0; j < n; j++) {
                                out.print(s[j]);
                            }
                            out.println();
                            return;
                        }
                    }
                    i--;
                    if (cnt[s[i] - 'a'] % k == 1)
                        todo -= k - 1;
                    else
                        todo++;
                    cnt[s[i] - 'a']--;
                }
            } else
                todo += delta;
            cnt[s[i] - 'a']++;
        }

        for (char c : s) {
            out.print(c);
        }
        out.println();

    }

    public static void main(String[] args) {
        in = new FastReader();
        out = new PrintWriter(System.out);

        int T = 1;
        T = in.nextInt();
        while (T-- > 0)
            solve();

        out.flush();
        out.close();
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        FastReader() {
            this(System.in);
        }
        FastReader(String file) throws FileNotFoundException {
            this(new FileInputStream(file));
        }
        FastReader(InputStream is) {
            br = new BufferedReader(new InputStreamReader(is));
        }

        int nextInt() {
            return Integer.parseInt(next());
        }
        long nextLong() {
            return Long.parseLong(next());
        }
        double nextDouble() {
            return Double.parseDouble(next());
        }
        String next() {
            while (st == null || !st.hasMoreTokens()) {
                st = new StringTokenizer(nextLine());
            }
            return st.nextToken();
        }
        String nextLine() {
            String line;
            try {
                line = br.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            return line;
        }
    }
}