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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskC solver = new TaskC();
        int testCount = Integer.parseInt(in.next());
        for (int i = 1; i <= testCount; i++)
            solver.solve(i, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int N = in.nextInt(), K = in.nextInt();
            char s[] = in.next().toCharArray();
            if (N % K > 0) {
                out.printLine(-1);
                return;
            }
            int freq[] = new int[26];
            for (int i = 0; i < N; i++) {
                freq[s[i] - 'a']++;
            }
            boolean alreadyValid = true;
            for (int i = 0; i < 26; i++) {
                if (freq[i] % K > 0) {
                    alreadyValid = false;
                }
            }
            if (alreadyValid) {
                for (int k = 0; k < N; k++) {
                    out.print(s[k]);
                }
                out.printLine();
                return;
            }
            for (int i = N - 1; i >= 0; i--) {
                freq[s[i] - 'a']--;
                if (s[i] == 'z') {
                    continue;
                }
                int req[] = new int[26], total = 0;
                for (int j = 0; j < 26; j++) {
                    int rem = freq[j] % K;
                    if (rem == 0) continue;
                    req[j] = K - rem;
                    total += req[j];
                }

                if (total <= (N - i)) {
                    if (total < N - i) {
                        if (req[s[i] - 'a' + 1] == 0) {
                            req[s[i] - 'a' + 1] = K;
                            total += K;
                        }
                        while (total < N - i) {
                            req[0] += K;
                            total += K;
                        }
                    }
                    for (int j = s[i] - 'a' + 1; j < 26; j++) {
                        if (req[j] > 0) {
                            s[i] = (char) (j + 'a');
                            req[j]--;
                            arrange(s, i + 1, req);
                            for (int k = 0; k < N; k++) {
                                out.print(s[k]);
                            }
                            out.printLine();
                            return;
                        }
                    }
                }
            }
            out.printLine(-1);
        }

        public void arrange(char s[], int index, int req[]) {
            int N = s.length;
            int j = 0;
            for (int i = index; i < N; i++) {
                while (j < 26 && req[j] == 0) {
                    j++;
                }
                s[i] = (char) (j + 'a');
                req[j]--;
            }
        }

    }

    static class InputReader {
        BufferedReader in;
        StringTokenizer tokenizer = null;

        public InputReader(InputStream inputStream) {
            in = new BufferedReader(new InputStreamReader(inputStream));
        }

        public String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(in.readLine());
                }
                return tokenizer.nextToken();
            } catch (IOException e) {
                return null;
            }
        }

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

    }

    static class OutputWriter {
        PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void printLine(Object... objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }

    }
}

