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.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Sandip Jana :)
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(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, PrintWriter out) {
            int n = in.readInt();
            int k = in.readInt();
            char ch[] = in.readString().toCharArray();
            if (n % k != 0) {
                out.println("-1");
                return;
            }


            int prefix[][] = new int[n + 1][26];
            for (int i = 1; i <= n; i++) {
                for (int j = 0; j < 26; j++)
                    prefix[i][j] = prefix[i - 1][j];
                prefix[i][ch[i - 1] - 'a'] += 1;
            }

            boolean valid = true;
            for (int j = 0; j < 26; j++) {
                valid = valid & (prefix[n][j] % k == 0 ? true : false);
            }

            if (valid) {
                out.println(String.valueOf(ch));
                return;
            }

            for (int i = n; i >= 1; i--) {
                char current = ch[i - 1];
                for (char transformed = (char) (current + 1); transformed <= 'z'; transformed++) {

                    int sum[] = Arrays.copyOf(prefix[i], prefix[i].length);
                    --sum[current - 'a'];
                    ++sum[transformed - 'a'];

                    int empty = n - i;
                    int need = 0;
                    for (int c = 0; c < 26; c++) {
                        if (sum[c] % k != 0) {
                            need += (k - sum[c] % k);
                        }
                    }

                    if (need == empty) {
                        generateAnswer(out, ch, i, transformed, 0, sum, k);
                        return;

                    } else if (need < empty) {
                        int blank = empty - need;
                        if (blank % k == 0) {
                            generateAnswer(out, ch, i, transformed, blank, sum, k);
                            return;
                        }
                    }
                }

            }

        }

        private void generateAnswer(PrintWriter out, char[] ch, int i, char transformed, int blank, int sum[], int k) {
            StringBuffer ans = new StringBuffer();
            ans.append(String.valueOf(ch).substring(0, i - 1));
            ans.append(transformed);

            for (int cnt = 0; cnt < blank; cnt++)
                ans.append('a');

            for (int j = 0; j < 26; j++) {
                if (sum[j] % k != 0) {
                    int need = k - sum[j] % k;
                    for (int cnt = 0; cnt < need; cnt++)
                        ans.append((char) (j + 'a'));
                }
            }

            out.println(ans);
            return;
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int readInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                if (Character.isValidCodePoint(c)) {
                    res.appendCodePoint(c);
                }
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next() {
            return readString();
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}

