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

public class codeforces {
	public static void main(String[] args) throws Exception {

		
		
		int t=sc.nextInt();
	Process:	while(t-->0) {
			int n=sc.nextInt();
			int k=sc.nextInt();
			int[]cou=new int[26];
			int[]ans=new int[26];
			char[]a=sc.next().toCharArray();
			if(n%k!=0) {
				pw.println(-1);
			}else {
				int left=n-Math.min(n, a.length);
				for(int i=0;i<Math.min(n, a.length);i++) {
					cou[a[i]-'a']++;
				}
				int temp=left;
				for(int kk=25;kk>-1;kk--) {
					ans[kk]=((cou[kk]+k-1)/k)*k-cou[kk];
					temp-=ans[kk];
				}
				
				
				
				if(temp>=0&&temp%k==0) {
					
					
					for(int kk=0;kk<Math.min(n, a.length);kk++) {
						pw.print(a[kk]);
						}
						for(int kk=0;kk<temp;kk++)pw.print('a');
						for(int kk=0;kk<26;kk++) {
							for(int jj=0;jj<ans[kk];jj++) {
								pw.print((char)(kk+'a'));
							}
						}
						pw.println();
//					pw.print("*");
					continue Process;
				}
				
				
				for(int i=Math.min(n, a.length)-1;i>-1;i--) {
//					pw.println(Arrays.toString(cou));
					cou[a[i]-'a']--;
					for(int j=a[i]+1;j<='z';j++) {
						cou[j-'a']++;
						 temp=left;
						for(int kk=25;kk>-1;kk--) {
							ans[kk]=((cou[kk]+k-1)/k)*k-cou[kk];
							temp-=ans[kk];
						}
						
//						pw.println(Arrays.toString(ans));
						cou[j-'a']--;
						if(temp>=0&&temp%k==0) {
							for(int kk=0;kk<i;kk++) {
							pw.print(a[kk]);
							}
							pw.print((char)j);
							for(int kk=0;kk<temp;kk++)pw.print('a');
							for(int kk=0;kk<26;kk++) {
								for(int jj=0;jj<ans[kk];jj++) {
									pw.print((char)(kk+'a'));
								}
							}
							pw.println();
							
							continue Process;
						}
					}
					left++;
				}
				
				
				
				
				pw.println(-1);
				
			}
		}
		pw.close();
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

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

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

		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 String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if (x.charAt(0) == '-') {
				neg = true;
				start++;
			}
			for (int i = start; i < x.length(); i++)
				if (x.charAt(i) == '.') {
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				} else {
					sb.append(x.charAt(i));
					if (dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg ? -1 : 1);
		}

		public long[] nextlongArray(int n) throws IOException {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		public Long[] nextLongArray(int n) throws IOException {
			Long[] a = new Long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		public int[] nextIntArray(int n) throws IOException {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		public Integer[] nextIntegerArray(int n) throws IOException {
			Integer[] a = new Integer[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

	}

	static class pair implements Comparable<pair> {
		long x;
		long y;

		public pair(long x, long y) {
			this.x = x;
			this.y = y;
		}

		public String toString() {
			return x + " " + y;
		}

		public boolean equals(Object o) {
			if (o instanceof pair) {
				pair p = (pair) o;
				return p.x == x && p.y == y;
			}
			return false;
		}

		public int hashCode() {
			return new Long(x).hashCode() * 31 + new Long(y).hashCode();
		}

		public int compareTo(pair other) {
			if (this.x == other.x) {
				return Long.compare(this.y, other.y);
			}
			return Long.compare(this.x, other.x);
		}
	}

	static class tuble implements Comparable<tuble> {
		int x;
		int y;
		int z;

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

		public String toString() {
			return x + " " + y + " " + z;
		}

		public int compareTo(tuble other) {
			if (this.x == other.x) {
				if (this.y == other.y) {
					return this.z - other.z;
				}
				return this.y - other.y;
			} else {
				return this.x - other.x;
			}
		}
	}

	static long mod = 1000000007;
	static Random rn = new Random();
	static Scanner sc = new Scanner(System.in);
	static PrintWriter pw = new PrintWriter(System.out);
}