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.util.*;
import java.io.*;
 
public class Main2 {
	static class FastReader{ 
        BufferedReader br; 
        StringTokenizer st; 
        public FastReader(){br = new BufferedReader(new InputStreamReader(System.in));}
        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; } 
    }
	static FastReader sc = new FastReader();
	static int n,k;
	static List<Character> res; static int[] req;
	static char[] s;
	public static void main (String[] args) {
		PrintWriter out = new PrintWriter(System.out);
		int t = 1;
    	t = sc.nextInt();
    	while(t-->0) {
    		n = sc.nextInt();
    		k = sc.nextInt();
    		s = sc.next().toCharArray();
    		req = new int[26];
    		res = new ArrayList<>();
    		if(n%k > 0) {
    			out.write("-1\n");
    			continue;
    		}
    		dfs(0,false);
    		for(char c : res)
    			out.write(c+"");
    		out.write("\n");
      	}
		out.close();
	}
	static boolean dfs(int idx, boolean isGrt) {
		int sum = sum(req);
		if(idx+sum>n) return false;
		if(idx == n) {
			return sum == 0;
		}
		for(int i = (isGrt?0:s[idx]-'a');i<26;i++) {
			req[i] = (req[i] + k - 1)%k;
			res.add((char) (i+'a'));
			if(dfs(idx + 1 , isGrt || s[idx]-'a'<i)) return true;
			res.remove(res.size()-1);
			req[i] = (req[i] + 1)%k;
		}
		return false;
	}
	static int sum(int[] req2) {
		int ret = 0;
		for(int val : req2) ret += val;
		return ret;
	}
}