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 Main2{
	static void main() throws Exception{
		int n=sc.nextInt(),k=sc.nextInt();
		 char[]in=sc.nextLine().toCharArray();
		 if(n%k!=0) {
			 pw.println(-1);
			 return;
		 }
		 int lo=0,hi=n;
		int best=0;
		while(lo<=hi) {
			int[]occ=new int[26];
			int mid=(lo+hi)>>1;
			int cnt=0;
		 	for(int i=0;i<mid;i++) {
		 		if(occ[in[i]-'a']%k==0)cnt+=k;
		 		occ[in[i]-'a']++;
		 	}
		 	if(cnt>n) {
		 		hi=mid-1;
		 		continue;
		 	}
		 	if(mid==n) {
		 		best=n;
		 		break;
		 	}
		 	boolean can=false;
		 	for(char c=(char)(in[mid]+1);c<='z';c++) {
		 		int[]curo=occ.clone();
		 		int curcnt=cnt;
		 		if(curo[c-'a']%k==0) {
		 			curcnt+=k;
		 		}
		 		curo[c-'a']++;
		 		if(curcnt>n)continue;
		 		can=true;
		 	}
		 	if(can) {
		 		best=mid;
		 		lo=mid+1;
		 	}
		 	else {
		 		hi=mid-1;
		 	}
		}
		int[]occ=new int[26];
		int cnt=0;
		for(int i=0;i<best;i++) {
			pw.print(in[i]);
			if(occ[in[i]-'a']%k==0)cnt+=k;
			occ[in[i]-'a']++;
		}
		if(best<n) {
			for(char c=(char)(in[best]+1);c<='z';c++) {
		 		int[]curo=occ.clone();
		 		int curcnt=cnt;
		 		if(curo[c-'a']%k==0) {
		 			curcnt+=k;
		 		}
		 		curo[c-'a']++;
		 		if(curcnt>n)continue;
		 		if(occ[c-'a']%k==0) {
		 			cnt+=k;
		 		}
		 		occ[c-'a']++;
		 		pw.print(c);
		 		break;
		 	}
		}
		while(cnt<n) {
			for(int i=0;i<k;i++)pw.print('a');
			cnt+=k;
		}
		for(int i=0;i<26;i++) {
			while(occ[i]%k!=0) {
				pw.print((char)(i+'a'));
				occ[i]++;
			}
		}
		pw.println();
    }
    public static void main(String[] args) throws Exception{
        sc=new MScanner(System.in);
        pw = new PrintWriter(System.out);
        int tc=1;
       tc=sc.nextInt();
        for(int i=1;i<=tc;i++) {
//            pw.printf("Case %d:\n", i);
            main();
        }
        pw.flush();
    }
    static PrintWriter pw;
    static MScanner sc;
    static class MScanner {
        StringTokenizer st;
        BufferedReader br;
        public MScanner(InputStream system) {
            br = new BufferedReader(new InputStreamReader(system));
        }
     
        public MScanner(String file) throws Exception {
            br = new BufferedReader(new FileReader(file));
        }
     
        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }
        public int[] intArr(int n) throws IOException {
            int[]in=new int[n];for(int i=0;i<n;i++)in[i]=nextInt();
            return in;
        }
        public long[] longArr(int n) throws IOException {
            long[]in=new long[n];for(int i=0;i<n;i++)in[i]=nextLong();
            return in;
        }
        public int[] intSortedArr(int n) throws IOException {
            int[]in=new int[n];for(int i=0;i<n;i++)in[i]=nextInt();
            shuffle(in);
            Arrays.sort(in);
            return in;
        }
        public long[] longSortedArr(int n) throws IOException {
            long[]in=new long[n];for(int i=0;i<n;i++)in[i]=nextLong();
            shuffle(in);
            Arrays.sort(in);
            return in;
        }
        public Integer[] IntegerArr(int n) throws IOException {
            Integer[]in=new Integer[n];for(int i=0;i<n;i++)in[i]=nextInt();
            return in;
        }
        public Long[] LongArr(int n) throws IOException {
            Long[]in=new Long[n];for(int i=0;i<n;i++)in[i]=nextLong();
            return in;
        }
        public String nextLine() throws IOException {
            return br.readLine();
        }
     
        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }
     
        public double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }
     
        public char nextChar() throws IOException {
            return next().charAt(0);
        }
     
        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }
     
        public boolean ready() throws IOException {
            return br.ready();
        }
     
        public void waitForInput() throws InterruptedException {
            Thread.sleep(3000);
        }
        
    }
    static void shuffle(int[]in) {
        for(int i=0;i<in.length;i++) {
            int idx=(int)(Math.random()*in.length);
            int tmp=in[i];
            in[i]=in[idx];
            in[idx]=tmp;
        }
    }
    static void shuffle(long[]in) {
        for(int i=0;i<in.length;i++) {
            int idx=(int)(Math.random()*in.length);
            long tmp=in[i];
            in[i]=in[idx];
            in[idx]=tmp;
        }
    }
}