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.*;
 
import java.math.*;
import java.awt.Point;
 
public class CFTemplate {
    static final long MOD = 1000000007L;
    //static final long MOD2 = 1000000009L;
    //static final long MOD = 998244353L;
    //static final long INF = 500000000000L;
    static final int INF = 1100000000;
    static final int NINF = -100000;
    static FastScanner sc;
    static PrintWriter pw;
    static final int[][] dirs = {{-1,0},{1,0},{0,-1},{0,1}};

    public static void main(String[] args) {
        sc = new FastScanner();
        pw = new PrintWriter(System.out);

        int Q = sc.ni();
        for (int q = 0; q < Q; q++) {
            int N = sc.ni();
            int K = sc.ni();
            String s = sc.next();

            if (N%K != 0) {
                pw.println(-1);
                continue;
            }
            int[] cnt = new int[26];
            for (int c: s.toCharArray()) {
                cnt[c-'a'] += 1;
            }

            loop:
            for (int i = N-1; i >= 0; i--) {
                int x = s.charAt(i)-'a';
                int MIN = i==N-1 ? x : x+1;
                for (int j = MIN; j < 26; j++) {
                    cnt[x] -= 1;
                    cnt[j] += 1;
                    int fixes = 0;
                    for (int k = 0; k < 26; k++) {
                        fixes += (K-(cnt[k]%K))%K;
                    }
                    if (fixes <= N-1-i) {
                        //we have an answer!
                        ArrayList<Character> ans = new ArrayList<>();
                        for (int k = 0; k < 26; k++) {
                            int f = (K-(cnt[k]%K))%K;
                            while (f > 0) {
                                ans.add((char)(k+'a'));
                                f--;
                            }
                        }
                        int as = N-1-i-fixes;
                        while (as > 0) {
                            ans.add('a');
                            as--;
                        }
                        Collections.sort(ans);
                        
                        pw.print(s.substring(0,i));
                        pw.print((char)(j+'a'));
                        for (char c: ans)
                            pw.print(c);
                        pw.println();
                        break loop;
                    }

                    cnt[x] += 1;
                    cnt[j] -= 1;
                }

                cnt[x] -= 1;
            }
        }
        
        
        pw.close();
    }
 
    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;
 
        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in), 32768);
            st = null;
        }
 
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
 
        int ni() {
            return Integer.parseInt(next());
        }
 
        int[] intArray(int N, int mod) {
            int[] ret = new int[N];
            for (int i = 0; i < N; i++)
                ret[i] = ni()+mod;
            return ret;
        }
 
        long nl() {
            return Long.parseLong(next());
        }
 
        long[] longArray(int N, long mod) {
            long[] ret = new long[N];
            for (int i = 0; i < N; i++)
                ret[i] = nl()+mod;
            return ret;
        }
 
        double nd() {
            return Double.parseDouble(next());
        }
 
        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}