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.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;

public class codeforces705_C {
    private static void solve(FastIOAdapter ioAdapter) {
        int n = ioAdapter.nextInt();
        int k = ioAdapter.nextInt();

        char[] s = ioAdapter.next().toCharArray();

        if (n % k == 0) {
            int[] counts = new int[26];
            for (int i = 0; i < n; i++) {
                counts[s[i] - 'a']++;
            }
            int sum = 0;
            boolean good = false;
            for (int i = 0; i < 26; ++i) {
                sum += getRestCount(counts[i], k);
            }
            if (sum == 0) {
                ioAdapter.out.println(new String(s));
            } else {
                for (int i = n - 1; i >= 0 && !good; i--) {
                    sum -= getRestCount(counts[s[i] - 'a'], k);
                    counts[s[i] - 'a']--;
                    sum += getRestCount(counts[s[i] - 'a'], k);
                    for (int j = s[i] - 'a' + 1; j < 26; j++) {
                        int lastSum = sum;
                        sum -= getRestCount(counts[j], k);
                        counts[j]++;
                        sum += getRestCount(counts[j], k);

                        if (i + sum + 1 <= n) {
                            for (int pos = 0; pos < i; pos++) {
                                ioAdapter.out.print(s[pos]);
                            }
                            ioAdapter.out.print((char) (j + 'a'));

                            if (n - (i + 1) > 0) {
                                char[] restChars = new char[n - (i + 1)];
                                int index = 0;
                                for (int l = 0; l < 26; l++) {
                                    int restCount = getRestCount(counts[l], k);
                                    while (restCount-- > 0) {
                                        restChars[index++] = (char) (l + 'a');
                                    }
                                }
                                while (index < restChars.length) {
                                    restChars[index++] = 'a';
                                }

                                Arrays.sort(restChars);
                                for (int l = 0; l < restChars.length; l++) {
                                    ioAdapter.out.print(restChars[l]);
                                }
                            }
                            good = true;
                            break;
                        }

                        counts[j]--;
                        sum = lastSum;
                    }
                }
                ioAdapter.out.println();
            }
        } else {
            ioAdapter.out.println(-1);
        }
    }

    private static int getRestCount(int x, int k) {
        return (k - x % k) % k;
    }

    public static void main(String[] args) throws Exception {
        try (FastIOAdapter ioAdapter = new FastIOAdapter()) {
            int count = 1;
            count = ioAdapter.nextInt();
            while (count-- > 0) {
                solve(ioAdapter);
            }
        }
    }

    static class FastIOAdapter implements AutoCloseable {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        public PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter((System.out))));
        StringTokenizer st = new StringTokenizer("");

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

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

        int[] readArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = nextInt();
            return a;
        }

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

        @Override
        public void close() throws Exception {
            out.flush();
            out.close();
            br.close();
        }
    }
}