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;
    	 int idx=-1;
    	 LinkedList<Character>ans=new LinkedList<Character>();
    	 boolean greater=false;
    	 int i;
    	 for(i=0;i<in.length;i++) {
    		 if(occ[in[i]-'a']%k==0) {
    			 if(cnt+k>n)break;
    			 if(cnt+k==n) {
    				 cnt+=k;
    				 occ[in[i]-'a']++;
    				 ans.add(in[i]);
    				 int[]ava=new int[26];
    				 for(int j=0;j<26;j++) {
    					 ava[j]=(k-(occ[j]%k))%k;
    				 }
    				 char max='z';
    				 boolean can=true;
    				 for(int j=i+1;j<n;j++) {
    					 while(max>='a' && ava[max-'a']==0)max--;
    					 if(max>in[j]) {
    						 break;
    					 }
    					 if(max<in[j]) {
    						 can=false;
    						 break;
    					 }
    					 ava[max-'a']--;
    				 }
    				 if(!can) {
    					 if(in[i]!='z') {
    						 occ[in[i]-'a']--;
    	    				 ans.pollLast();
    						 in[i]++;
    						 occ[in[i]-'a']++;
    	    				 ans.add(in[i]);
    	    				 greater=true;
    	    				 i++;
    					 }
    					 else {
    						 idx=i;
    						 while(in[idx]=='z')idx--;
    					 }
    				 }
    				 else {
    					 i++;
    				 }
    				 break;
    				 
    			 }
    			 cnt+=k;
    			 
    		 }
    		 occ[in[i]-'a']++;
			 ans.add(in[i]);
    	 }
    	 if(idx==-1) {
    		 int[]ava=new int[26];
    		 int free=(n-cnt)/k;
    		 for(int j=0;j<26;j++) {
    			 ava[j]=(k-(occ[j]%k))%k;
    		 }
    		 while(!greater && i<n) {
    			 if(ava[in[i]-'a']>0) {
    				 ans.add(in[i]);
	    			 ava[in[i]-'a']--;
	    			 i++;
	    			 continue;
    			 }
    			 if(free>0) {
    				 ans.add(in[i]);
    				 ava[in[i]-'a']+=k;
	    			 ava[in[i]-'a']--;
	    			 free-=k;
	    			 i++;
	    			 continue;
    			 }
    			 boolean f=false;
    			 for(int c=in[i]-'a'+1;c<26;c++) {
    				 if(ava[c]>0) {
    					 f=true;
    					 ava[c]--;
    					 ans.add((char)(c+'a'));
    					 greater=false;
    				 }
    			 }
    			 if(!f) {
    				 idx=i;
    				 break;
    			 }
    			 else {
    				 break;
    			 }
    		 }
    		 if(idx!=-1) {
    			 o:while(!ans.isEmpty()) {
    				 char c=ans.pollLast();
    				 ava[c-'a']++;
    				 if(ava[c-'a']%k==0) {
    					 ava[c-'a']-=k;
    					 free+=k;
    				 }
    				 if(c=='z')continue;
    				 if(free>0) {
    					 int j=c-'a'+1;
    					 ava[j]+=k;
    					 ava[j]--;
    					 free-=k;
    					 ans.add((char)(j+'a'));
						 break o;
    				 }
    				 for(int j=c-'a'+1;j<26;j++) {
    					 if(ava[j]>0) {
    						 ava[j]--;
        					 ans.add((char)(j+'a'));
    						 break o;
    					 }
    				 }
    			 }
    		 }
	    	 while(free>0) {
	    		 for(int j=0;j<k;j++) {
	    			 ans.add('a');
	    			 occ[0]++;
	    		 }
	    		 free-=k;
	    	 }
	    	 for(int j=0;j<26;j++) {
	    		 while(ava[j]>0) {
	    			 ava[j]--;
	    			 ans.add((char)(j+'a'));
	    		 }
	    	 }
	    	 while(!ans.isEmpty())pw.print(ans.pollFirst());
	    	 pw.println();
	    	 return;
    	 }

    	 occ=new int[26];
    	 cnt=0;
    	 ans=new LinkedList<Character>();
    	 in[idx]++;
    	 for(i=0;i<=idx;i++) {
    		 if(occ[in[i]-'a']%k==0) {
    			 if(cnt+k>n)break;
    			 if(cnt+k==n) {
    				 int[]ava=new int[26];
    				 for(int j=0;j<26;j++) {
    					 ava[j]=(k-(occ[j]%k))%k;
    				 }
    				 char max='z';
    				 boolean can=false;
    				 for(int j=i+1;j<n;j++) {
    					 while(max>='a' && ava[max-'a']==0)max--;
    					 if(max>in[j]) {
    						 can=true;
    						 break;
    					 }
    					 if(max<in[j])break;
    					 ava[max-'a']--;
    				 }
    				 if(!can) {
    					 if(in[i]!='z')
    						 in[i]++;
    					 else {
    						 idx=i;
    						 while(in[idx]=='z')idx--;
    						 break;
    					 }
    				 }
    				 cnt+=k;
    				 occ[in[i]-'a']++;
    				 ans.add(in[i]);
    				 break;
    			 }
    			 cnt+=k;
    			 
    		 }
    		 occ[in[i]-'a']++;
			 ans.add(in[i]);
    	 }
    	 while(cnt<n) {
    		 for(int j=0;j<k;j++) {
    			 ans.add('a');
    			 occ[0]++;
    		 }
    		 cnt+=k;
    	 }
    	 for(int j=0;i<26;i++) {
    		 while(occ[j]%k!=0) {
    			 occ[j]++;
    			 ans.add((char)(j+'a'));
    		 }
    	 }
    	 while(!ans.isEmpty())pw.print(ans.pollFirst());
    	 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;
        }
    }
}