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.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class Practice {
	public static void main(String[] args) throws Exception {
		Scanner s = new Scanner(System.in);
		int t = s.nextInt();
		while (t-- > 0) {
			int n = s.nextInt();
			int k = s.nextInt();
			String str = s.next();
			if (n % k != 0) {
				System.out.println(-1);
			} else {

				int[] pre = new int[26];
				for (int i = 0; i < n; i++) {
					pre[str.charAt(i) - 'a']++;
				}
				
				int flag = 1;
				for (int i = 0; i < 26; i++) {
					if (pre[i] % k != 0) {
						flag = 0;
						break;
					}
				}
				if (flag == 1) {
					System.out.println(str);
					continue;
				}
				int i = n - 1;
				flag = 1;
				StringBuilder ans=new StringBuilder();
				for (i = n - 1; i >= 0; i--) {
					pre[str.charAt(i) - 'a']--;
					for (int j = str.charAt(i) + 1; j <= 'z'; j++) {
						pre[j - 'a']++;
						int no = 0;
						for (int l = 0; l < 26; l++) {
							no = no+(k - pre[l] % k) % k;
						}
						//System.out.println(no);
						if (no <= n - i - 1) {
							
							for (int p = 0; p < 26; p++) {
								pre[p] += (k - pre[p] % k) % k;
							}
//							for(int p=0;p<26;p++) {
//								System.out.print(pre[p]+" ");
//							}System.out.println();
							for(int p=0;p<i;p++) {
								ans.append(str.charAt(p));
								pre[str.charAt(p)-'a']--;
							}
							ans.append((char)j);
							pre[j-'a']--;
							pre[0]+=n - i -1 - no;
							
							flag = 0;
							break;
						}
						
						pre[j - 'a']--;

					}
					if (flag == 0) {
						break;
					}
//					for(int p=0;p<26;p++) {
//						System.out.print(pre[p]+" ");
//					}System.out.println();
					
					
				}
				for(int j=0;j<26;j++) {
					while(pre[j]!=0) {
						ans.append((char)('a'+j));
						pre[j]--;
					}
				}
				System.out.println(ans);
			}
		}
	}

}