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

// package FinalGrind;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Problem7 {
    public static void main(String[] args)throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        int test=Integer.parseInt(br.readLine());
        StringBuilder print=new StringBuilder();
        while(test--!=0){
            StringTokenizer st=new StringTokenizer(br.readLine());
            int n=Integer.parseInt(st.nextToken());
            int k=Integer.parseInt(st.nextToken());
            char c[]=br.readLine().toCharArray();
            if(n%k!=0){
                print.append("-1\n");
            }
            if(check(c,k)){
                for(int i=0;i<c.length;i++){
                    print.append(c[i]);
                }
                print.append("\n");
                continue;
            }
            int count[][]=new int[n][26];
            for(int i=0;i<n;i++){
                for(int j=0;j<26;j++){
                    if(i!=0)
                    count[i][j]=count[i-1][j];
                }
                count[i][c[i]-97]++;
            }
            boolean flag=false;
            for(int i=n-1;i>=0;i--){
                for(int j=c[i]+1;j<=122;j++){
                    int f[]=new int[26];
                    if(i!=0){
                        for(int p=0;p<26;p++){
                            f[p]=count[i-1][p];
                        }
                    }
                    f[j-97]++;
                    int rem=n-i-1;
                    int reqd=0;
                    for(int p=0;p<26;p++){
                        if(f[p]%k!=0){
                            reqd+=(k-f[p]%k);
                        }
                    }
                    if(reqd<=rem&&(rem-reqd)%k==0){
//                        System.out.println(rem+" "+reqd);
//                        print(f);
                        char ans[]=new char[n];
                        int x=n-1;
                        for(int p=25;p>=0;p--){
                            if(f[p]%k!=0){
                                int r=k-f[p]%k;
                                while(r--!=0){
                                    ans[x]=(char)(p+97);
                                    x--;
                                }
                            }
                        }
                        while(x>i){
                            ans[x]='a';
                            x--;
                        }
                        ans[i]=(char)(j);
                        x=i-1;
                        while(x>=0){
                            ans[x]=c[x];
                            x--;
                        }
                        for(int p=0;p<n;p++){
                            print.append(ans[p]);
                        }
                        print.append("\n");
                        flag=true;
                        break;
                    }
                }
                if(flag){
                    break;
                }
            }

        }
        System.out.print(print.toString());
    }
    public static boolean check(char c[],int k){
        int f[]=new int[26];
        for(int i=0;i<c.length;i++){
            f[c[i]-97]++;
        }
        boolean ans=true;
        for(int i=0;i<26;i++){
            ans=ans&&(f[i]%k==0);
        }
        return ans;
    }
    public static void print(int a[]){
        for(int i=0;i<a.length;i++){
            System.out.print(a[i]+" ");
        }
        System.out.println();
    }
}
