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 Main {
    public static void main(String args[])
    {
        FastReader input=new FastReader();
        PrintWriter out=new PrintWriter(System.out);
        int T=input.nextInt();
        while(T-->0)
        {
            int n=input.nextInt();
            int k=input.nextInt();
            String s=input.next();
            if(s.length()%k!=0)
            {
                out.println(-1);
            }
            else
            {
                int a[]=new int[26];
                for(int i=0;i<s.length();i++)
                {
                    char c=s.charAt(i);
                    a[c-'a']++;
                }
                int f=0;
                for(int i=0;i<a.length;i++)
                {
                    int co=a[i];
                    if(co%k!=0)
                    {
                        f=1;
                        break;
                    }
                }
                if(f==0)
                {
                    out.println(s);
                }
                else
                {
                    int in=-1;
                    char temp='0';
                    int arr[]=new int[26];
                    for(int i=0;i<s.length();i++)
                    {
                        int count=0;
                        for(int j=0;j<26;j++)
                        {
                            int r=arr[j]%k;
                            if(r!=0)
                            {
                                r=k-r;
                            }
                            count+=r;
                        }
                        char ch=s.charAt(i);
                        int val=ch-'a';
                        val++;
                        for(int j=val;j<26;j++)
                        {
                            int r=arr[j]%k;
                            if(r!=0)
                            {
                                r=k-r;
                            }
                            int v=count-r;
                            int r1=arr[j]+1;
                            r1=r1%k;
                            if(r1!=0)
                            {
                                r1=k-r1;
                            }
                            v=v+r1;
                            int rem=s.length()-(i+1);
                            rem-=v;
                            if(rem>=0 && rem%k==0)
                            {
                                in=i;
                                temp=(char)(j+'a');
                                break;
                            }
                        }
                        arr[ch-'a']++;
                    }
                    if(in==-1)
                    {
                        out.println(-1);
                    }
                    else
                    {
                        StringBuilder sb=new StringBuilder("");
                        sb.append(s.substring(0,in));
                        sb.append(temp);
                        arr=new int[26];
                        for(int i=0;i<in;i++)
                        {
                            char ch=s.charAt(i);
                            arr[ch-'a']++;
                        }
                        arr[temp-'a']++;
                        StringBuilder sb1=new StringBuilder();
                        for(int i=0;i<26;i++)
                        {
                            int r=arr[i]%k;
                            if(r!=0)
                            {
                                r=k-r;
                            }
                            char c1=(char)(i+'a');
                            for(int j=0;j<r;j++)
                            {
                                sb1.append(c1);
                            }
                        }
                        int rem=s.length()-(in+1);
                        rem-=sb1.toString().length();
                        for(int i=0;i<rem;i++)
                        {
                            sb.append("a");
                        }
                        sb.append(sb1);
                        out.println(sb.toString());
                    }
                }
            }
        }
        out.close();
    }
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;
        public FastReader()
        {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        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;
        }
    }
}