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.util.*;
import java.lang.*;
import java.io.*;

//HashMap<Integer,Integer> hm=new HashMap<>();
//ArrayList<Integer> list=new ArrayList<>();
//HashSet<Integer> hs=new HashSet<>();
//Stack<Integer> st=new Stack<>();
//Queue<Integer> q=new LinkedList<>();
//PriorityQueue<Integer> pq=new PriorityQueue<>();
// static ArrayList<ArrayList<Integer>> gp=new ArrayList<>();
//int[] arr=new int[n];
//System.out.println("YES");
//1 hr- atleast 2 qs d-2
//Mt_do 3 qs d-2  
//Mt_do 4 qs d-3


public class cf705 {
    
    public static int get(int val,int k){
        return (k-val%k)%k;
    }
    public static void main(String[] args) throws Exception{
        InputStreamReader ip=new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(ip);
        // Scanner scn=new Scanner(System.in);
        int t= Integer.parseInt(br.readLine());

        while(t-->0){
        //    int n=Integer.parseInt(br.readLine());//Integer.parseInt(strs[0]),m=Integer.parseInt(strs[1]);
            String[] strs=(br.readLine()).trim().split(" ");
            // // String strs=(br.readLine()).trim();
            int n=Integer.parseInt(strs[0]),k=Integer.parseInt(strs[1]);//,k=Integer.parseInt(strs[2]);

           String str=(br.readLine()).trim();

           if(n%k!=0){System.out.println(-1); continue;}

           int[] cnt=new int[26];

           for(char ch:str.toCharArray()){
               cnt[ch-'a']++;
           }

           int sum=0;

           for(int i=0;i<26;i++){
               sum+=get(cnt[i],k);
           }

           if(sum==0){
               System.out.println(str);  continue;
           }
           char[] s=str.toCharArray();
           boolean f=true;

           for(int i=n-1;i>=0 && f;i--){
            sum-=get(cnt[s[i]-'a'],k);
            cnt[s[i]-'a']--;
            sum+=get(cnt[s[i]-'a'],k);

            for(int j=(s[i]-'a')+1;j<26 && f;j++){
                int osum=sum;
                sum-=get(cnt[j],k);
                cnt[j]++;
                sum+=get(cnt[j],k);

                if(sum<=(n-(i+1))){
                    for(int r=0;r<i;r++){
                        System.out.print(s[r]);  //mymistake  s[i]
                    }

                    System.out.print((char)('a'+j));
                    // String add="";
                    StringBuilder sb=new StringBuilder();
                    for(int r=0;r<26;r++){
                        int req=get(cnt[r], k);
                        char ch=(char)('a'+r);
                        while(req-->0){
                            sb.append(ch);//add+=ch;//System.out.print(ch);
                        }
                    }

                    int cta=(n-(i+1))-sum;//sum =add.length();
                    
                    while(cta-->0){sb.append('a');}//add+='a';}

                    String add=sb.toString();      
                    char[] aarr=add.toCharArray();

                    Arrays.sort(aarr);

                    for(char c1:aarr){System.out.print(c1);}

                    System.out.println();
                    f=false;
                    break;
                }
                cnt[j]--;
                sum=osum;
            }
           }
        }
    }
}
