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

public class Template {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int yo = sc.nextInt();
		while (yo-- > 0) {
			int n = sc.nextInt();
			int k = sc.nextInt();
			String s = sc.next();
			
			if(n%k != 0) {
				System.out.println(-1);
				continue;
			}
			
			int[] count = new int[26];
			for(int i = 0; i < n; i++) {
				count[s.charAt(i)-'a']++;
			}
			
			boolean div = true;
			for(int e : count) {
				if(e%k != 0) {
					div = false;
				}
			}
			
			if(div) {
				System.out.println(s);
				continue;
			}
			
			boolean found = false;
			int save = -1;
			int i;
			int left = 0;
			for(i = n-1; i >= 0; i--) {
				int rem = 0;
				for(int j = s.charAt(i)-'a'+1; j < 26; j++) {
					int place = 0;
					for(int K = 0; K < 26; K++) {
						if(s.charAt(i)-'a' == K) {
							rem = count[K]-1;
							rem = (k-(rem%k))%k;
							place += rem;
						}
						else if(j == K){
							rem = count[K]+1;
							rem = (k-(rem%k))%k;
							place += rem;
						}
						else {
							rem = count[K];
							rem = (k-(rem%k))%k;
							place += rem;
						}
					}
					if(place > n-i-1) {
						
					}
					else {
						left = (n-i-1)-place;
						if(left%k == 0) {
							found = true;
							save = j;
							break;
						}
					}
				}
				if(found) break;
				count[s.charAt(i)-'a']--;
			}
			
			String ans = "";
			
			Arrays.fill(count, 0);
//			System.out.println((char)('a'+save) + " " + i);
			
			for(int j = 0; j < i; j++) {
				ans += s.charAt(j);
				count[s.charAt(j)-'a']++;
			}
			
			ans += (char)('a'+save);
			count[save]++;
			
			while(left-- > 0) {
				ans += 'a';
			}
			
			for(int j = 0; j < 26; j++) {
				while(count[j]%k != 0) {
					count[j]++;
					ans += (char)(j+'a');
				}
			}
			System.out.println(ans);
		}
		
	}

	static class Pair {
		int x;
		int y;

		public Pair(int x, int y) {
			this.x = x;
			this.y = y;
		}
	}

	static void ruffleSort(int[] a) {
		int n = a.length;
		Random r = new Random();
		for (int i = 0; i < a.length; i++) {
			int oi = r.nextInt(n), temp = a[i];
			a[i] = a[oi];
			a[oi] = temp;
		}
		Arrays.sort(a);
	}

	static long gcd(long a, long b) {
		if (b == 0)
			return a;
		return gcd(b, a % b);
	}

	static boolean[] sieve(int n) {
		boolean isPrime[] = new boolean[n + 1];
		for (int i = 2; i <= n; i++) {
			if (isPrime[i])
				continue;
			for (int j = 2 * i; j <= n; j += i) {
				isPrime[j] = true;
			}
		}
		return isPrime;
	}

	static int mod = 1000000007;

	static long pow(int a, long b) {
		if (b == 0) {
			return 1;
		}
		if (b == 1) {
			return a;
		}
		if (b % 2 == 0) {
			long ans = pow(a, b / 2);
			return ans * ans;
		} else {
			long ans = pow(a, (b - 1) / 2);
			return a * ans * ans;
		}

	}

	static class FastScanner {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		String next() {
			while (!st.hasMoreTokens())
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		int[] readArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		long nextLong() {
			return Long.parseLong(next());
		}
	}

	//	For Input.txt and Output.txt	
	//	FileInputStream in = new FileInputStream("input.txt");
	//	FileOutputStream out = new FileOutputStream("output.txt");
	//	PrintWriter pw = new PrintWriter(out);
	//	Scanner sc = new Scanner(in);
}
