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.ArrayList;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;

public class C {

    public static void main(String[] args) {
        FastReader scan = new FastReader();
        PrintWriter out = new PrintWriter(System.out);
        Task solver = new Task();
        int t = scan.nextInt();
        for(int tt = 1; tt <= t; tt++) solver.solve(tt, scan, out);
        out.close();
    }

    static class Task {

        public void solve(int testNumber, FastReader scan, PrintWriter out) {
            int n = scan.nextInt(), k = scan.nextInt();
            char[] s = scan.next().toCharArray();
            if(n % k != 0) {
                out.println(-1);
                return;
            }
            int[] freq = new int[26];
            for(char c : s) freq[c - 'a']++;

            boolean goodAlready = true;
            for(int i = 0; i < 26; i++) {
                if(freq[i] % k != 0) {
                    goodAlready = false;
                    break;
                }
            }
            if(goodAlready) {
                out.println(new String(s));
                return;
            }

            for(int i = n - 1; i >= 0; i--) {
                freq[s[i] - 'a']--;
                for(char j = (char) (s[i] + 1); j <= 'z'; j++) {
                    int[] temp = new int[26];
                    freq[j - 'a']++;
                    int left = n - i - 1;
                    //out.println(left);
                    boolean good = true;
                    for(int l = 0; l < 26; l++) {
                        int need = (k - freq[l] % k) % k;
                        if(need > left) {
                            good = false;
                            break;
                        }
                        left -= need;
                        temp[l] += need;
                    }
                    temp[0] += left;
                    if(good) {
                        for(int index = 0; index < i; index++) out.print(s[index]);
                        out.print(j);
                        for(int l = 0; l < 26; l++) {
                            for(int x = 0; x < temp[l]; x++) out.print((char) (l + 'a'));
                        }
                        out.println();
                        return;
                    }
                    freq[j - 'a']--;
                }
            }
        }
    }

    static void ruffleSort(int[] a) {
        Random get = new Random();
        for (int i = 0; i < a.length; i++) {
            int r = get.nextInt(a.length);
            int temp = a[i];
            a[i] = a[r];
            a[r] = temp;
        }
        Arrays.sort(a);
    }

    static void ruffleSort(long[] a) {
        Random get = new Random();
        for (int i = 0; i < a.length; i++) {
            int r = get.nextInt(a.length);
            long temp = a[i];
            a[i] = a[r];
            a[r] = temp;
        }
        Arrays.sort(a);
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public FastReader(String s) throws FileNotFoundException {
            br = new BufferedReader(new FileReader(new File(s)));
        }

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

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

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

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

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

}