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 arr[]=new int[26];
                    int in=-1;
                    for(int i=0;i<s.length();i++) {
                        char c = s.charAt(i);
                        if (c != 'z')
                        {
                            char cha1=c;
                            int val=c-'a';
                            val++;
                            for(int l=val;l<26;l++)
                            {
                                c=(char)(l+'a');
                                arr[c - 'a']++;
                                int count = 0;
                                for (int j = 0; j < arr.length; j++) {
                                    if (arr[j] != 0) {
                                        int r = arr[j] % k;
                                        if (r != 0) {
                                            r = k - r;
                                        }
                                        count += r;
                                    }
                                }
                                int rem = s.length() - (i + 1);
                                rem -= count;
                            /*
                            if(i==8)
                            {
                                out.println(count);
                            }

                             */
                                if (rem >= 0 && rem % k == 0) {
                                    in = i;
                                }
                                int v=c-'a';
                                arr[c-'a']--;
                                v=cha1-'a';
                                arr[v]++;
                            }
                        }
                        else
                        {
                            arr[c-'a']++;
                        }
                    }
                    if(in==-1)
                    {
                        out.println(-1);
                    }
                    else
                    {
                        arr=new int[26];
                        for(int i=0;i<in;i++)
                        {
                            arr[s.charAt(i)-'a']++;
                        }
                        char ch=s.charAt(in);
                        ch++;
                        arr[ch-'a']++;
                        String str="";
                        int count=0;
                        for(int i=0;i<26;i++)
                        {
                            if(arr[i]!=0)
                            {
                                int r = arr[i] % k;
                                if (r != 0) {
                                    r = k - r;
                                }
                                count+=r;
                                char c=(char)(i+'a');
                                for(int j=0;j<r;j++)
                                {
                                    str+=c;
                                }
                            }
                        }
                        int rem = s.length() - (in + 1);
                        rem -= count;
                        String s1="";
                        for(int i=0;i<rem;i++)
                        {
                            s1+='a';
                        }
                        String ans=s.substring(0,in);
                        ans+=ch;
                        ans+=s1;
                        ans+=str;
                        out.println(ans);
                    }
                }
            }
        }
        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;
        }
    }
}