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 Main{
	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[]occ=new int[26];
		int cnt=0;
		for(int i=0;i<n;i++) {
			if(occ[in[i]-'a']%k==0) {
				cnt+=k;
			}
			occ[in[i]-'a']++;
		}
		if(cnt<=n) {
			for(int i=0;i<n;i++)pw.print(in[i]);
			pw.println();
			return;
		}
		int fix=0;
		o:for(int i=n-1;i>=0;i--) {
			occ[in[i]-'a']--;
			if(occ[in[i]-'a']%k==0)cnt-=k;
			for(char c=(char)(in[i]+1);c<='z';c++) {
				int tmpcnt=cnt;
				if(occ[c-'a']%k==0) {
					tmpcnt+=k;
				}
				if(tmpcnt<=n) {
					fix=i;
					break o;
				}
			}
		}
		
		for(int i=0;i<fix;i++)pw.print(in[i]);
		for(char c=(char)(in[fix]+1);c<='z';c++) {
			int tmpcnt=cnt;
			if(occ[c-'a']%k==0) {
				tmpcnt+=k;
			}
			if(tmpcnt<=n) {
				pw.print(c);
				if(occ[c-'a']%k==0) {
					cnt+=k;
				}
				occ[c-'a']++;
				break;
			}
		}
		while(cnt<n) {
			for(int i=0;i<k;i++)pw.print('a');
			cnt+=k;
		}
		for(char c='a';c<='z';c++) {
			while(occ[c-'a']%k!=0) {
				pw.print(c);
				occ[c-'a']++;
			}
		}
		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;
        }
    }
}