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.util.*;

import java.util.StringTokenizer;
 
public class C_K_beautiful_Strings {
    static FastReader scanner = new FastReader();

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;
 
        public FastReader()
        {
            br = new BufferedReader(
                new InputStreamReader(System.in));
        }
         
        int[] arrayInput(int size)
        {
            int a[]=new int[size];
            for(int i=0;i<size;i++)
            {
                a[i]=nextInt();
            }
            return a;
        }
 
        String next()
        {
            while (st == null || !st.hasMoreElements()) {
                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()
        {
            String str = "";
            try {
                str = br.readLine();
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
    static void forLoop(int arr[],int start,int last,int value)
    {
        for(int i=start;i<last;i++)
         arr[i]=value;
    }
     static void forLoopEndEqual(int arr[],int start,int last,int value)
    {
        for(int i=start;i<=last;i++)
         arr[i]=value;
    }
    static void debug(int a){
        System.out.print(a+" ");
    }
     static void debug(int a,int b){
        System.out.print(a+" "+b);
    }
     static void lineBreak(){
        System.out.println("");
    }

    
  /////////////////////////////////////////////////////////////MAIN///////////////////////////////////////  
    
     public static void main(String[] args)
    {
       
        int t = scanner.nextInt();
      
    while(t>0)
    { 
       solve();
     
        t-=1;
    }
        
    }
    ////////////////////////////
    
   
  
   //////////////////////////////////////////////////////////////Solve//////////////////////////////////////// 
    static void solve(){
       
      int n=scanner.nextInt();
      int k=scanner.nextInt();
      String t=scanner.next();

      int L=0,U=n;
    int ans=0;
    int found=0;
    int rem=0;
    int r=0;
   String s="";
    String ss="";
      while(L<=U){
        int mid=(L+U)/2;
         s="";
        int ar[]=new int[200];
        Arrays.fill(ar,0);
          rem=0;
        for(int i=0;i<mid;i++)
        {
           s+=t.charAt(i);
           ar[t.charAt(i)-'a']=(ar[t.charAt(i)-'a']+k-1)%k;

        }
        
        for(int i=0;i<26;i++)
        {
            rem+=ar[i];
            
            
        }
 
        if(mid+rem<=n)
        {
        for(int i=0;i<n-mid-rem;i++)
{
    s+='z';
}
 for(int i=25;i>=0;i--)
        {
            while(ar[i]>0)
            {
                s+=(char)('a'+i);
                ar[i]--;
            }
            
            
        }

        if(s.compareTo(t)>=0)
        {
            found=1;
           ans=mid;
           
             
        }
        else{
            found=0;}

        }
  if(found==1)
  { 
     L=mid+1;
  }
  else{
 U=mid-1;
  }

      }
      s="";
      rem=0;
      found=0;
 int ar[]=new int[200];
        Arrays.fill(ar,0);
 //  System.out.println(ans);
       for(int i=0;i<ans;i++)
        {
           s+=t.charAt(i);
           ar[t.charAt(i)-'a']=(ar[t.charAt(i)-'a']+k-1)%k;

        }
        if(s.length()==n)
        {
            //System.out.println(s);
          found=1;

        }else{

       /////////////




 for(char i =(char)(t.charAt(ans)+1);i<='z';i++)
        {

          s+=(char)i;
          //  System.out.println(s);
          ar[i-'a']=(ar[i-'a']+k-1)%k;

          for(int j=0;j<26;j++)
        {
            rem+=ar[j];
            
            
        }

        if(rem+ans<=n)
        {
        for(int j='a';j<='z';j++)
        {


             while(ar[j-'a']>0)
             {

                s+=(char)j;
                ar[j-'a']--;

             }

             if(s.compareTo(t)>0)
             {
                 found=1;
             }


        }
 
        }
        if(found==1)
        {
            break;
        }
        else{

        while(s.length()>t.length())
        { 
            char cr=s.charAt(s.length()-1);
           // System.out.println(cr+" "+s);
            s=s.substring(s.length()-1);
            ar[cr-'a']=(ar[cr-'a']+1)%k;


        }


        }

        }

    }

       ////////////////
    



if(found==1)
System.out.println(s+" ");
else
  System.out.println("-1");

       
      

    }
 }