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.Arrays;
import java.util.Scanner;

public class C_K_beautifulStrings {
	public static int get(int count, int k) {
		return (k - count % k) % k;
	}
	
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		
		int t = in.nextInt();
		while (t-- > 0) {
			int[] cnt = new int[26];
			int n, k;
			n = in.nextInt();
			k = in.nextInt();
			in.nextLine();
			
			StringBuilder sb = new StringBuilder();
			//sb = in.nextLine();
			sb.append(in.nextLine());
			//System.out.println(n + " - " + k + " - " + s);

			for (char c : sb.toString().toCharArray()) cnt[c - 'a']++;
			//System.out.println(Arrays.toString(cnt));
			
			int sum = 0;
			boolean flag = true;
			for (int i = 0 ; i < 26; i++)
				sum += get(cnt[i], k);
			//System.out.println(sum);
			
			if (sum == 0) {
				System.out.println(sb);
				flag = false;
			}
			
			if (n % k != 0) {
				System.out.println(-1);
				continue;
			}
			
			// i는 주어진 문자열의 인덱스
			// sum은 변경해야할 문자의 수
			for (int i = n - 1 ; i >= 0 && flag ; i--) {		
				sum -= get(cnt[sb.charAt(i) - 'a'], k);		
				cnt[sb.charAt(i) - 'a']--;					// 해당하는 문자열 카운트 1 감소
				sum += get(cnt[sb.charAt(i) - 'a'], k);		// 
				
				for(int j = sb.charAt(i) - 'a' + 1 ; j < 26 ; j++) {
					
					int lst_sum = sum;
					sum -= get(cnt[j], k);
					cnt[j]++;
					sum += get(cnt[j], k);
					
					if (i + sum + 1 <= n) {
						for (int pos = 0 ; pos < i ; pos++)
							System.out.print(sb.charAt(pos));
						System.out.print((char)('a' + j));
					
						StringBuilder add = new StringBuilder();
						for (int w = 0; w < 26 ; w++) {
							int f = get(cnt[w], k);
							while(f > 0) {
								f--;
								//add += ((char)('a' + w ));
								add.append((char)('a' + w ));
							}
						}
					
						while(add.length() + i + 1 < n) {
							//add += "a";
							add.append("a");
						}
						char[] temp = add.toString().toCharArray();
						Arrays.sort(temp);
						System.out.println(new String(temp));
						flag = false;
						break;
					}
					cnt[j]--;
					sum = lst_sum;
				}
			}
		}
		
		in.close();
	}
}
