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.Scanner;

public class C705 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        while(t-- >0){
            int n = sc.nextInt(), k=sc.nextInt();
            String s = sc.next();

            if(n%k!=0){
                System.out.println(-1);
                continue;
            }
            int[] hash = new int[200];
            int times = n/k;
            char[] dis = new char[200];
            int j=0;
            int i=0;
            for(;i<s.length()&&j<times;i++){
                char c = s.charAt(i);

                if(i>0){
                    if(hash[c]==0){
                        dis[j++]=c;
                        //System.out.println("Entered : " + c + " i : " + i);
                    }
                }
                else{
                    dis[j++]=c;
                }

                hash[c]++;

                int req=0;
                for(int p=0;p<j;p++){
                    int rem = (hash[dis[p]]%k);
                    if(rem>0)
                        req+=k-rem;
                }
                if(i+req>=n || j==times){
                    i++;
                    break;
                }

            }

            //System.out.println(i + " " + j);
            i--;
            if(k>1){
                char nc = 0;
                int l=i;
                for(;l>=0;l--){
                    if(s.charAt(l)!='z'){
                        nc= (char)((int)s.charAt(l)+1);
                        break;
                    }
                }

                if(l<0){
                    System.out.println(-1);
                    continue;
                }
                StringBuilder ans = new StringBuilder();
                ans.append(s, 0, l);
                ans.append(nc);

                hash=new int[200];
                l=0;
                for(;l<ans.length();l++){
                    hash[ans.charAt(l)]++;
                }

                l=199;
                int leftCount = n-ans.length();
                String right = "";
                for(;l>=0;l--){
                    if(hash[l]>0){
                        while(hash[l]<k){
                            right = ((char)l) + ""+ right;
                            hash[l]++;
                         }
                    }
                }

                if(right.length()<leftCount){
                    right=right.charAt(0) + "" + right;
                }

                //System.out.println(ans);
                System.out.println(ans+right);
            }
            else{
                System.out.println(s);
            }
        }
    }
}
