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.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.util.TreeMap;

public class Main {

	public Main() throws FileNotFoundException {
//
		File file = Paths.get("input.txt").toFile();
		if (file.exists()) {
			System.setIn(new FileInputStream(file));
		}
		long t = System.currentTimeMillis();

		FastReader reader = new FastReader();

		int ttt = reader.nextInt();

		for (int tt = 0; tt < ttt; tt++) {
			int n = reader.nextInt();
			int k = reader.nextInt();
			
			
			
			char[] c = reader.next().toCharArray();
			
			if(n%k!=0) {
				System.out.println(-1);
				continue;
			}
			
			int sum=0;
			int[] cnt=new int[26];
			
			for(int i=0;i<c.length;i++) {
				cnt[c[i]-'a']++;
			}
			for(int i=0;i<26;i++) {
				sum+=needed(k,cnt[i]);
			}
			
			if(sum==0) {
				System.out.println(new String(c));
				continue;
			}
			
			boolean notdone=true;
			
			for(int i=n-1;i>=0&&notdone;i--) {
				
				int idx=c[i]-'a';
				sum-=needed(k,cnt[idx]);
				cnt[idx]--;
				sum+=needed(k,cnt[idx]);
				
				
				
				for(int j=idx+1;j<26&&notdone;j++) {
					
					int lastSum=sum;
					sum-=needed(k,cnt[j]);
					cnt[j]++;
					sum+=needed(k,cnt[j]);
					
					if(sum+1+i<=n) {
						
						StringBuilder sb=new StringBuilder();
						
						for(int z=0;z<i;z++) {
							sb.append(c[z]);
						}
						
						sb.append((char)(j+'a'));
						
						char[] tail=new char[n-i-1];
						int tailIdx=0;
						for(int z=0;z<26;z++) {
							int f=needed(k, cnt[z]);
							while(f>0) {
								tail[tailIdx++]=(char)(z+'a');
								f--;
							}
						}
						while(tailIdx<n-i-1) {
							tail[tailIdx++]='a';
						}
						
						Arrays.sort(tail);
						
						sb.append(tail);
						System.out.println(sb.toString());
						notdone=false;
						break;
					}
					cnt[j]--;
					sum=lastSum;
				}
				
				
				
			}
			
			

		}

	}
	
	int needed(int k,int x) {
		return (k-x%k)%k;
	}

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

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

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

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

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

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}

	public static void main(String[] args) throws FileNotFoundException {
		new Main();
	}

}
