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

//https://github.com/EgorKulikov/yaal/tree/master/lib/main/net/egork
        
import java.util.*;
import java.io.*;
public class B{
    static PrintWriter out;
    static InputReader in;
    public static void main(String args[]){
        out = new PrintWriter(System.out);
        in = new InputReader();
        new B();
        out.flush(); out.close();
    }   
    B(){
        solve();
    }
    void solve(){
    	int t = in.nextInt();
    	while(t-- > 0){
    		int n = in.nextInt(), k = in.nextInt();
    		char c[] = in.next().trim().toCharArray();
    		int ans[] = new int[n];
    		int f[] = new int[26];
			for(int i = 0; i < n; i++){
				ans[i] = c[i] - 'a';
				f[ans[i]]++;
			}
			boolean rs = true;
			for(int i = 0; i < 26; i++){
				if(f[i] % k != 0)rs = false;
			}
			for(int i = n - 1; i >= 0 && !rs; i--){
				int ch = c[i] - 'a';
				f[ch]--;
				int r = 0;
				int max = 0;
				for(int j = 0; j < 26; j++){
					if(f[j] % k == 0)continue;
					r += k - f[j] % k;
					max = Math.max(max, j);
				}
				int left = n - i;
				if(r <= left && max > ch){
					for(int j = ch + 1; j < 26; j++){
						if(f[j] % k != 0 ){
							ans[i] = j; f[j]++;
							break;
						}
					}
					rs = true;
				}else if((r < left && ch < 25)){
					ans[i] = ch + 1; f[ch + 1]++;
					rs = true;
				}
				if(rs){
					int p = i + 1;
					for(int j = 0; j < 26; j++){
						if(f[j] % k == 0){
							continue;
						}
						int fill = k - f[j] % k;
						for(int k1 = p; k1 <= p + fill - 1 && k1 < n; k1++){
							ans[k1] = j;
						}
						p += fill;
					}
				}
			}
    		rs &= (n % k == 0);
    		if(rs){
    			for(int i = 0; i < n; i++)out.print((char)(ans[i] + 'a'));
    			out.println();
    		}else{
    			out.println(-1);
    		}
    	}
    }
    public static class InputReader{
        BufferedReader br;
        StringTokenizer st;
        InputReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        public int nextInt(){
            return Integer.parseInt(next());
        }
        public long nextLong(){
            return Long.parseLong(next());
        }
        public double nextDouble(){
            return Double.parseDouble(next());
        }
        public String next(){
            while(st == null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch(IOException e){}
            }
            return st.nextToken();
        }
    }
}
	