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.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.*;

import javafx.util.Pair;

public class Main
{

   

    public static void main(String[] args)
    {
        FastScanner input = new FastScanner();
        int tc = input.nextInt();
        work:    while (tc-- > 0) {
          int n = input.nextInt();
       int k = input.nextInt();
       String s = input.next();
       int letter[] = new int[26];
        for (int i = 0; i < s.length(); i++) {
            letter[s.charAt(i)-'a']++;
        }
        boolean check = true;
        if(n%k!=0)
        {
            System.out.println("-1");
            continue work;
        }
        for (int i = 0; i <26; i++) {
            if(letter[i]%k!=0)
            {
                check = false;
                break;
            }
            
                
        }
        if(check)
        {
            System.out.println(s);
         continue work;
        }
        StringBuilder ans = new StringBuilder();
        
            int flag=1;
            for (int i = s.length()-1; i >=0; i--) {
            letter[s.charAt(i)-'a']--;
            for (int j = s.charAt(i)+1; j <='z'; j++) {
                letter[j-'a']++;
                int need=0;
                for (int l = 0; l <26; l++) {
                    need=need+(k-letter[l]%k)%k;
                }
//                System.out.println(need);
                if(need<=n-i-1)
                {
                    for (int l = 0; l <26; l++) {
                        letter[l]+=((k-letter[l]%k)%k);
                    }
                    for (int l = 0; l < i; l++) {
                        ans.append(s.charAt(l));
                        letter[s.charAt(l)-'a']--;
                    }
                    ans.append((char)j);
                    letter[j-'a']--;
                    letter[0]+=(n-i-1-need);
                    flag=0;
                    break;
                }
                
                 letter[j-'a']--;
                
                
               
            }
            if(flag==0)
                    break;
        }
        
        for (int i = 0; i < 26; i++) {
            while(letter[i]!=0)
            {
                ans.append((char)(i+'a'));
                letter[i]--;
            }
        }
        System.out.println(ans);   
        }
        
    }

    static class FastScanner
    {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");

        String next()
        {
            while (!st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {

            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine() throws IOException
        {
            return br.readLine();
        }
    }

}
