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 Ishu
{
    static Scanner scan = new Scanner(System.in);
    static BufferedWriter output = new BufferedWriter(new OutputStreamWriter(System.out)); 
    static void tc() throws Exception
    {
    int n = scan.nextInt();
    int k = scan.nextInt();
    String str = scan.next();
    char[] ch = new char[n + 1];
    int i,j;
    
    int[] ini = new int[26];
    for(i=1;i<=n;++i)
        {
        ch[i] = str.charAt(i-1);
        ini[ch[i] - 'a']++;
        }
        
    boolean flag = true;
    for(i=0;i<26;++i)
        if(ini[i] % k > 0)
            {
            flag = false;
            break;
            }
            
    if(flag)
        {
        output.write(str + "\n");
        output.flush();
        return;
        }        
    int[][] hash = new int[26][n + 1];
    for(i=1;i<=n;++i)
        {
        for(j=0;j<26;++j)
            hash[j][i] = hash[j][i-1];
            
        ++hash[ch[i] - 'a'][i];
        }
        
    boolean pos = false;    
    char[] ans = new char[n + 1];
    for(i=n;i>0;--i)
        {
        for(int l=(ch[i]-'a'+1);l<26;++l)
            {
            int sum = 0;
            --hash[ch[i]-'a'][i];
            ++hash[l][i];
            
            for(j=0;j<26;++j)
                {
                int cf = hash[j][i];
                int quo = cf / k;
                int rem = cf % k;
                if(rem > 0)
                    quo++;
                    
                int next = quo * k;
                sum += next - cf;
                }
                
            int rem = n - i;
            if(rem - sum >= 0 && (rem - sum) % k == 0)
                {
                pos = true;
                for(j=1;j<i;++j)
                    {
                    ans[j] = ch[j];
                    }
                    
                ans[j] = (char)(l + 'a');
              //  --hash[l][i];
                
             //   for(int m=0;m<n;++m)
               //     System.out.println(hash[m][i]);
                j = n;
                for(int m=25;m>=0;--m)
                    {
                    if(hash[m][i] == 0)
                        continue;
                        
                    int cf = hash[m][i];
                    int quo = cf / k;
                    int remm = cf % k;
                    if(remm > 0)
                        quo++;
                        
                    hash[m][i] = quo * k - cf;    
                        
                    while(hash[m][i] > 0)
                        {
                        --hash[m][i];
                        ans[j--] = (char)('a' + m);
                        }    
                    } 
                while(j > i)
                    ans[j--] = 'a';    
                    
                j = 26;
                l = 26;
                i = 0;
                break;
                }
            if(l < 26)
                {
                ++hash[ch[i]-'a'][i];
                --hash[l][i];  
                }          
            }      
        if(i > 0)
            --hash[ch[i]-'a'][i];  
        }    
    if(!pos)
        output.write("-1\n");
    else
        {
        for(i=1;i<=n;++i)
            output.write(ans[i]);
        output.write("\n");
        }
    output.flush();
    }
    public static void main(String[] args) throws Exception
    {
    int t = 1;
    t = scan.nextInt();
    while(t-- > 0)
        tc();
    }
}
