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

public class C1493 {

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		int t = sc.nextInt();
		while (t-- > 0) {
			int n = sc.nextInt();
			int k = sc.nextInt();
			char[] arr = sc.next().toCharArray();
			int[] cnt = new int[26];
			if (n % k != 0) {
				pw.println(-1);
				continue;
			}
			int maxIdx = -1;
			char minChar = 'z';
			int[] reqCnt = new int[26];
			for (int i = 0; i < n; i++) {
				for (char c = 'z'; c > arr[i]; c--) {
					cnt[c - 'a']++;
					int sumReq = 0;
					for (int w = 0; w < 26; w++) {
						sumReq += (k - (cnt[w] % k)) % k;
					}
					if (sumReq <= n - 1 - i) {
						maxIdx = i;
						minChar = c;
						reqCnt = cnt.clone();
					}
					cnt[c - 'a']--;
				}
				cnt[arr[i] - 'a']++;
			}
			boolean b = true;
			for (int x : cnt)
				b &= x % k == 0;
			if (b) {
				pw.println(new String(arr));
			} else {
				arr[maxIdx] = minChar;
				int cur = arr.length - 1;
				for (int i = 25; i >= 0; i--) {
					while (reqCnt[i] % k != 0) {
						reqCnt[i]++;
						arr[cur--] = (char) (i + 'a');
					}
				}
				while (cur > maxIdx) {
					arr[cur--] = 'a';
				}
				pw.println(new String(arr));
			}
		}
		pw.close();
	}

	static class Scanner {
		BufferedReader br;
		StringTokenizer st;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public Scanner(FileReader f) {
			br = new BufferedReader(f);
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

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

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

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public int[] nextIntArr(int n) throws IOException {
			int[] arr = new int[n];
			for (int i = 0; i < n; i++) {
				arr[i] = Integer.parseInt(next());
			}
			return arr;
		}

	}

}
