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.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.PriorityQueue;
import java.util.Map.Entry;

import java.util.Random;
import java.util.TreeSet;

public final class CF_705_D2_C
{


	static boolean verb=true;
	static void log(Object X){if (verb) System.err.println(X);}
	static void log(Object[] X){if (verb) {for (Object U:X) System.err.print(U+" ");System.err.println("");}}
	static void log(int[] X){if (verb) {for (int U:X) System.err.print(U+" ");System.err.println("");}}
	static void logWln(int[] X){if (verb) {for (int U:X) System.err.print(U+" ");}}
	static void log(int[] X,int L){if (verb) {for (int i=0;i<L;i++) System.err.print(X[i]+" ");System.err.println("");}}
	static void log(long[] X){if (verb) {for (long U:X) System.err.print(U+" ");System.err.println("");}}

	static void logWln(Object X){if (verb) System.err.print(X);}
	static void info(Object o){	System.out.println(o);}
	static void output(Object o){outputWln(""+o+"\n");	}
	static void outputFlush(Object o){try {out.write(""+ o+"\n");out.flush();} catch (Exception e) {}}
	static void outputWln(Object o){try {out.write(""+ o);} catch (Exception e) {}}


	static void logBin(int[] tm) {for (int x:tm) logWln(bin(8,x)+" ");log("");}

	static String bin(int L,int x) {
		String s=Integer.toBinaryString(x);
		while (s.length()<L) s="0"+s;
		return s;
	}

	static long powerMod(long b,long e,long m){
		long x=1;
		while (e>0) {
			if (e%2==1)
				x=(b*x)%m;
			b=(b*b)%m;
			e=e/2;
		}
		return x; 
	}



	static class Composite implements Comparable<Composite>{
		int a;
		int b;
		int idx;

		public int compareTo(Composite X) {
			if (a!=X.a)
				return a-X.a;
			if (b!=X.b)
				return b-X.b;
			return idx-X.idx;
		}

		public Composite(int a, int b, int idx) {
			this.a = a;
			this.b = b;
			this.idx = idx;
		}


	}




	static long mod=1000000007;
	static int[][] dd={{-1,0},{0,1},{1,0},{0,-1}};
	static int CX=26;


	// Global vars
	static BufferedWriter out;
	static InputReader reader;


	static String solve(String s,int k) {
		int L=s.length();
		int CX=26;
		int[][] need=new int[L][CX];

		// find the top rightest element which is ok
		int[] reserved=new int[L];
		int bob=0;
		int av=L;
		int limit=L;
		for (int i=0;i<L;i++) {
			av--;
			//log("bob:"+bob+" av:"+av);
			if (i>0)
			for (int u=0;u<CX;u++)
				need[i][u]=need[i-1][u];
			int x=s.charAt(i)-'a';
			//log("x:"+x+" need:"+need[i][x]);
			if (need[i][x]>0) {
				need[i][x]--;
				bob--;
			} else {
				need[i][x]=k-1;
				bob+=k-1;
			}
			if (bob>av) {
				limit=i;
				break;
			}
		}
		
		//log("s:"+s+" limit:"+limit);
		
		if (limit==L)
			return s;
		char[] ans=s.toCharArray();
		
		for (int i=limit-1;i>=0;i--) {
			//log("============== i:"+i);
			// we need to be stronger than s[i+1]
			
			/*
			log("i:"+i);
			for (int u=0;u<CX;u++)
				log((char)('a'+u)+" // "+need[i][u]);
			*/
			int ref=s.charAt(i+1)-'a';
			if (ref+1<CX) {
				int sum=0;
				int exist=-1;
				for (int u=CX-1;u>=0;u--) {
					sum+=need[i][u];
					if (need[i][u]>0 && u>ref) {
						exist=u;
					}
				}
				int rem=L-(i+1);
				
				if (exist==ref+1) {
					//log("case 1");
					ans[i+1]=(char)('a'+ref+1);
					need[i][ref+1]--;
					// if some place we fill with 'a'
					while (sum<rem) {
						sum+=k;
						need[i][0]+=k;
					}
					int j=i+2;
					for (int u=0;u<CX;u++) {
						while (need[i][u]>0) {
							ans[j++]=(char)('a'+u);
							need[i][u]--;
						}
					}
					return new String(ans);
					
				} else {
					//log("case 2");
					// can we pick something better?
					if (sum<rem) {
						//log("case 2a");
						// yes
						
						ans[i+1]=(char)('a'+ref+1);
					//log("yo with "+(char)('a'+ref+1));
						sum+=k;
						need[i][ref+1]+=k-1;
						int j=i+2;
						for (int u=0;u<CX;u++) {
							while (need[i][u]>0) {
								ans[j++]=(char)('a'+u);
								need[i][u]--;
							}
						}
						return new String(ans);
					}
					if (exist>ref) {
						//log("case 2b");
						ans[i+1]=(char)('a'+exist);
						need[i][exist]--;
						int j=i+2;
						for (int u=0;u<CX;u++) {
							while (need[i][u]>0) {
								ans[j++]=(char)('a'+u);
								need[i][u]--;
							}
						}
						return new String(ans);
						
					}
				}
			}
			
		}
		char c=s.charAt(0);
		if (c=='z') {
			Arrays.fill(ans, c);
			return new String(ans);
		}
		int[] dm=new int[CX];
		int sm=k;
		int x=c-'a';
		dm[x+1]=k-1;
		while (sm<L) {
			sm+=k;
			dm[0]+=k;
		}
		ans[0]=(char)(x+1+'a');
		int j=1;
		log(dm);
		for (int u=0;u<CX;u++) {
			while (dm[u]>0) {
				ans[j++]=(char)('a'+u);
				dm[u]--;
			}
		}
		return new String(ans);
		
	}
	
	
	static void test() {
		log("testing");
		Random r=new Random();
		int NMAX=10;
		int NTESTS=1000;
		for (int t=0;t<NTESTS;t++) {
			int L=20;
			char[] c=new char[L];
			for (int i=0;i<L;i++) {
				int x=r.nextInt(26);
				c[i]=(char)('a'+x);
			}
			String s=new String(c);
			log("trying :: 1 "+s.length()+" "+2+" "+s);
			
			String ss=solve(s,2);
			log(s+" --> "+ss);
			
		}
		log("done");
	}

	static void process() throws Exception {

		out = new BufferedWriter(new OutputStreamWriter(System.out));
		reader = new InputReader(System.in);

		//test();
		
		int T=reader.readInt();
		for (int t=0;t<T;t++) {
			int n=reader.readInt();
			int k=reader.readInt();
			String s=reader.readString();
			String ans="-1";
			if (n%k==0) {
				ans=solve(s,k);
			}
			output(ans);
			
		
		}

		try {
			out.close();
		} catch (Exception Ex) {
		}

	}


	public static void main(String[] args) throws Exception {
		process();

	}

	static final class InputReader {
		private final InputStream stream;
		private final byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		private int read() throws IOException {
			if (curChar >= numChars) {
				curChar = 0;
				numChars = stream.read(buf);
				if (numChars <= 0) {
					return -1;
				}
			}
			return buf[curChar++];
		}

		public final String readString() throws IOException {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			StringBuilder res = new StringBuilder();
			do {
				res.append((char) c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public final String readString(int L) throws IOException {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			StringBuilder res = new StringBuilder(L);
			do {
				res.append((char) c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public final int readInt() throws IOException {
			int c = read();
			boolean neg = false;
			while (isSpaceChar(c)) {
				c = read();
			}
			char d = (char) c;
			// log("d:"+d);
			if (d == '-') {
				neg = true;
				c = read();
			}
			int res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			// log("res:"+res);
			if (neg)
				return -res;
			return res;

		}

		public final long readLong() throws IOException {
			int c = read();
			boolean neg = false;
			while (isSpaceChar(c)) {
				c = read();
			}
			char d = (char) c;
			// log("d:"+d);
			if (d == '-') {
				neg = true;
				c = read();
			}
			long res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			// log("res:"+res);
			if (neg)
				return -res;
			return res;

		}

		private boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}
	}

}