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.*;
public class KBeautifulStrings2000 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int T = sc.nextInt();
		StringBuilder strb = new StringBuilder();
		for (int t = 0;t<T;t++) {
			int N = sc.nextInt();
			int K = sc.nextInt();
			String str = sc.next();
			int pivot = -1;
			int pivotC = -1;
			int[] ansAdd = new int[26];
			int aAdd = 0;
			int[] cnt = new int[26];
			
			for (int i = 0;i<N;i++) {
				char c = str.charAt(i);
				cnt[c-'a']++;
				int[] minAdd = new int[26];
				int sum = 0;
				for (int a = 0;a<='z'-'a';a++) {
					minAdd[a] = (K-cnt[a]%K)%K;
					sum += minAdd[a];
				}
				//if string originally beautiful
				if (i==N-1&&sum==0) {
					//System.out.println("eefe");
					pivot = i;
					continue;
				}
				if (i<N-1) {
					char pivC = str.charAt(i+1);
					int tempSum = sum;
					for (int a = pivC-'a'+1;a<='z'-'a';a++) {
						//System.out.println(minAdd[1]);
						sum = tempSum;
						minAdd[a]--;
						boolean s = false;
						if (minAdd[a]==-1) {
							sum += K-1;
							s = true;
							minAdd[a] = K-1;
						}else {
							sum--;
						}
						
						int suff = N-(i+1)-1;
						if (sum==suff) {
							//System.out.println(sum+" "+suff+" "+i+" "+minAdd['c'-'a']);
							pivot = i;
							pivotC = a;
							ansAdd = Arrays.copyOf(minAdd, 26);
							aAdd = 0;
							break;
						}else if (sum<suff) {
							suff -= sum;
							if (suff%K==0) {
								//System.out.println(sum+" "+suff+" "+i+" "+minAdd['c'-'a']);
								pivot = i;
								pivotC = a;
								ansAdd = Arrays.copyOf(minAdd, 26);
								aAdd = suff;
								break;
							}
						}
						if (s)
							minAdd[a] = 0;
						else
							minAdd[a]++;
					}
				}
			}
			
			if (pivot==-1) {
				strb.append(-1).append("\n");
			}else if (pivot==N-1) {
				strb.append(str).append("\n");
			}else {
				String ans = str.substring(0,pivot+1);
				ans+=Character.toString((char)	(pivotC+'a'));
				for (int i = 0;i<aAdd;i++) {
					ans += "a";
				}
				for (int a = 'a';a<='z';a++) {
					for (int b = 0;b<ansAdd[a-'a'];b++) {
						ans+=Character.toString((char)a);
					}
				}
				strb.append(ans).append("\n");
			}
		}
		System.out.println(strb);
	}

}
