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.util.*;
import java.io.*;
//import java.math.*;

public class Task{
        //  ..............code begins here..............

static long mod=(long)1e9+7,inf=(long)1e15;

static void solve() throws IOException {
            int[] x=int_arr();
            int n=x[0],k=x[1];
            char[] c=read().toCharArray();
            if(n%k!=0){out.write("-1\n");return;}

            int[][] dp=new int[n+1][26];
            for(int i=1;i<=n;i++){
                dp[i][c[i-1]-'a']++;
                for(int j=0;j<26;j++){
                    dp[i][j]+=dp[i-1][j];
                }
            }
            boolean ok=true;
            for(int i=0;i<26;i++){
                if(dp[n][i]%k!=0)ok=false;
            }
            if(ok){out.write(c);out.write("\n");return;}
            for(int i=n-1;i>=0;i--){
                for(char cc=(char)((int)c[i]+1);cc<='z';cc++){
                    int curr=k-dp[i][cc-'a']%k,extra=0,tot=0;
                    if(curr<k)extra-=curr;
                    List<Character> l=new ArrayList<>();
                    int[] f=new int[26];
                    for(int j=0;j<26;j++){
                        tot+=dp[i][j];
                        int tmp=(k-dp[i][j]%k)%k;
                        extra+=tmp;
                        if(cc-'a'!=j) f[j]=tmp;
                    }
                    f[cc-'a']+=curr-1;
                    if(n>=(tot+curr+extra)&&(n-(tot+curr+extra))%k==0){
                        for(int j=0;j<i;j++){out.write(c[j]);}
                        for(int j=1;j<=n-(tot+curr+extra);j++)l.add('a');
                        for(int j=0;j<26;j++){
                            for(int k1=1;k1<=f[j];k1++)l.add((char)(j+(int)'a'));
                        }
                        Collections.sort(l);
                        out.write(cc);
                        for(char c1:l)out.write(c1);
                        out.write("\n");return;
                    }
                }
            }
            out.write("-1\n");
}
//
public static void main(String[] args) throws  IOException{
                assign();
                int t=int_v(read());
                while(t--!=0){
                    //out.write("Case #"+cn+": ");
                    solve();
                }
                out.flush();
}

// taking inputs
static BufferedReader s1;
static BufferedWriter out;
static String read() throws IOException{String line="";while(line.length()==0){line=s1.readLine();continue;}return line;}
static int int_v (String s1){return Integer.parseInt(s1);}
static long long_v(String s1){return Long.parseLong(s1);}
static void sort(int[] a){List<Integer> l=new ArrayList<>();for(int x:a){l.add(x);}Collections.sort(l);for(int i=0;i<a.length;i++){a[i]=l.get(i);}}
static int[] int_arr() throws IOException{String[] a=read().split(" ");int[] b=new int[a.length];for(int i=0;i<a.length;i++){b[i]=int_v(a[i]);}return b;}
static long[] long_arr() throws IOException{String[] a=read().split(" ");long[] b=new long[a.length];for(int i=0;i<a.length;i++){b[i]=long_v(a[i]);}return b;}
static void assign(){s1=new BufferedReader(new InputStreamReader(System.in));out=new BufferedWriter(new OutputStreamWriter(System.out));}
//static String setpreciosion(double d,int k){BigDecimal d1 = new BigDecimal(Double.toString(d));return d1.setScale(k,RoundingMode.HALF_UP).toString();}//UP DOWN HALF_UP
static int add(int a,int b){int z=a+b;if(z>=mod)z-=mod;return z;}
static long gcd(long a,long b){if(b==0){return a;}return gcd(b,a%b);}
static long Modpow(long a,long p,long m){long res=1;while(p>0){if((p&1)!=0){res=(res*a)%m;}p >>=1;a=(a*a)%m;}return res%m;}
static long Modmul(long a,long b,long m){return ((a%m)*(b%m))%m;}
static long ModInv(long a,long m){return Modpow(a,m-2,m);}
//static long nck(int n,int r,long m){if(r>n){return 0l;}return Modmul(f[n],ModInv(Modmul(f[n-r],f[r],m),m),m);}
//static long[] f;
}