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[] cnt = new int[26];
        for (int i = 0; i < n; i++) {
            cnt[s[i] - 'a']++;
        }
        boolean beautiful = true;
        for (int i = 0; i < 26; i++) {
            if (cnt[i] % k != 0)
                beautiful = false;
        }
        if (beautiful) {
            for (int i = 0; i < n; i++) {
                out.print(s[i]);
            }
            out.println();
            return;
        }
        for (int i = n - 1; i >= 0; i--) {
            cnt[s[i] - 'a']--;
            for (char c = (char) (s[i] + 1); c <= 'z'; c++) {
                cnt[c - 'a']++;
                int todo = 0;
                for (int j = 0; j < 26; j++) {
                    todo += (k - cnt[j] % k) % k;
                }
                if (todo <= n - i - 1) {
                    StringBuilder t = new StringBuilder();
                    for (int j = 0; j < i; j++) {
                        t.append(s[j]);
                    }
                    t.append(c);
                    t.append("a".repeat(n - i - 1 - todo));
                    for (int j = 0; j < 26; j++) {
                        t.append(String.valueOf((char) ('a' + j)).repeat((k - cnt[j] % k) % k));
                    }
                    out.println(t.toString());
                    return;
                }
                cnt[c - 'a']--;
            }
        }


    }

    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;
        }
    }
}