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.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Random;
import java.util.StringTokenizer;

public final class C {

    public static void main(String[] args) {
        final FastScanner fs = new FastScanner();
        final PrintWriter pw = new PrintWriter(System.out);
        final int q = fs.nextInt();
        for (int query = 0; query < q; query++) {
            final int n = fs.nextInt();
            final int k = fs.nextInt();
            final String s = fs.next();
            if (n % k != 0) {
                pw.println(-1);
                continue;
            }
            final int[] freq = new int[26];
            for (int c : s.toCharArray()) {
                freq[c - 'a'] += 1;
            }
            outer:
            for (int i = n - 1; i >= 0; i--) {
                final int x = s.charAt(i) - 'a';
                final int MIN = i == n - 1 ? x : x + 1;
                for (int j = MIN; j < 26; j++) {
                    freq[x] -= 1;
                    freq[j] += 1;
                    int fixes = 0;
                    for (int c = 0; c < 26; c++) {
                        fixes += (k - (freq[c] % k)) % k;
                    }
                    if (fixes <= n - 1 - i) {
                        //we have an answer!
                        final List<Character> ans = new ArrayList<>();
                        for (int c = 0; c < 26; c++) {
                            int f = (k - (freq[c] % k)) % k;
                            while (f > 0) {
                                ans.add((char) (c + 'a'));
                                f--;
                            }
                        }
                        int as = n - 1 - i - fixes;
                        while (as > 0) {
                            ans.add('a');
                            as--;
                        }
                        Collections.sort(ans);
                        final StringBuilder res = new StringBuilder();
                        res.append(s, 0, i);
                        res.append((char) (j + 'a'));
                        for (char c : ans) {
                            res.append(c);
                        }
                        pw.println(res);
                        break outer;
                    }
                    freq[x] += 1;
                    freq[j] -= 1;
                }
                freq[x] -= 1;
            }
        }
        pw.close();
    }

    static final class Utils {
        private static class Shuffler {
            private static void shuffle(int[] x) {
                final Random r = new Random();

                for (int i = 0; i <= x.length - 2; i++) {
                    final int j = i + r.nextInt(x.length - i);
                    swap(x, i, j);
                }
            }

            private static void shuffle(long[] x) {
                final Random r = new Random();

                for (int i = 0; i <= x.length - 2; i++) {
                    final int j = i + r.nextInt(x.length - i);
                    swap(x, i, j);
                }
            }

            private static void swap(int[] x, int i, int j) {
                final int t = x[i];
                x[i] = x[j];
                x[j] = t;
            }

            private static void swap(long[] x, int i, int j) {
                final long t = x[i];
                x[i] = x[j];
                x[j] = t;
            }
        }

        public static void shuffleSort(int[] arr) {
            Shuffler.shuffle(arr);
            Arrays.sort(arr);
        }

        public static void shuffleSort(long[] arr) {
            Shuffler.shuffle(arr);
            Arrays.sort(arr);
        }

        private Utils() {}
    }

    static class FastScanner {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");

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

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

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

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

        long[] nextLongArray(int n) {
            final long[] a = new long[n];
            for (int i = 0; i < n; i++) { a[i] = nextLong(); }
            return a;
        }
    }
}
