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.StringTokenizer;

public class C {

    public int remainder(int x, int k) {
        return (k - x % k) % k;
    }

    public void solve() {
        int t = in.nextInt();

        while (t-- > 0) {
            int n = in.nextInt();
            int k = in.nextInt();
            char s[] = in.next().toCharArray();

            if (n % k != 0) {
                out.println(-1);
                continue;
            }

            int a[] = new int[26];
            for (int i = 0; i<s.length; i++)
                a[s[i] - 'a']++;

            boolean isPossible = true;

            for (int c = 0; c<26; c++) {
                if (a[c] % k != 0)
                    isPossible = false;
            }

            if (isPossible) {
                for (char c: s) {
                    out.print(c);
                }
                out.println();
                continue;
            }

            int prefs[][] = new int[n][26];

            for (int i = 0; i<s.length; i++) {
                prefs[i][s[i] - 'a']++;
                if (i>0) {
                    for (int x = 0; x < 26; x++)
                        prefs[i][x] += prefs[i - 1][x];
                }
            }
            boolean flag = true;

            for (int i = n-1; i >= 0 && flag; i--) {
                prefs[i][s[i] - 'a']--;
                for (char c = (char)(s[i]+1); c<='z' && flag; c++) {
                    prefs[i][c - 'a']++;
                    char prev = s[i];
                    s[i] = c;
                    int sum = 0;
                    for (int x=0; x<26; x++) {
                        sum += remainder(prefs[i][x], k);
                    }

                    if (sum + i + 1 <= n) {
                        flag = false;
                        int j = n-1;
                        for (int x = 25; x>=0; x--) {
                            int r = remainder(prefs[i][x], k);
                            while (r>0) {
                                s[j] = (char)(x + 'a');
                                j--;
                                r--;
                            }
                        }

                        while (j > i ) {
                            s[j] = 'a';
                            j--;
                        }
                        break;
                    }
                    prefs[i][c - 'a']--;
                    s[i] = prev;
                }

                prefs[i][s[i] - 'a']++;
            }


            for (char c: s) {
                out.print(c);
            }

            out.println();

        }
    }

    String input = "";
    String output = "";
    FastScanner in;
    PrintWriter out;

    void run() throws Exception {
        if (input.length() == 0) {
            in = new FastScanner(System.in);
        } else {
            in = new FastScanner(new File(input));
        }
        if (output.length() == 0) {
            out = new PrintWriter(System.out);
        } else {
            out = new PrintWriter(new File(output));
        }

        solve();

        out.close();

    }

    public static void main(String[] args) throws Exception {
        new C().run();
    }

    class FastScanner {

        BufferedReader bf;
        StringTokenizer st;

        public FastScanner(InputStream is) {
            bf = new BufferedReader(new InputStreamReader(is));
        }

        public FastScanner(File fr) throws FileNotFoundException {
            bf = new BufferedReader(new FileReader(fr));
        }

        public String next() {
            try {
                while (st == null || !st.hasMoreTokens()) {
                    st = new StringTokenizer(bf.readLine());
                }
            } catch (IOException ex) {
                ex.printStackTrace();
            }
            return st.nextToken();
        }

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

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

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public int[] readIntArray(int length) {
            int arr[] = new int[length];
            for (int i = 0; i<length; i++)
                arr[i] = nextInt();
            return arr;
        }
    }
}