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

public class Main {
    public static void main(String args[]) {new Main().run();}

    FastReader in = new FastReader();
    PrintWriter out = new PrintWriter(System.out);
    void run(){
        for(int q=ni();q>0;q--){
            work();
        }
        out.flush();
    }
    long mod=1000000007;
    long gcd(long a,long b) {
        return a==0?b:gcd(b%a,a);
    }
    void work() {
        int n=ni(),k=ni();
        String str=ns();
        if(n%k!=0){
            out.println(-1);
            return;
        }
        int cur=0;
        StringBuilder sb=new StringBuilder();
        int[] rec=new int[26];
        for(int i=0;i<n;i++){
            char c=str.charAt(i);
            rec[c-'a']++;
            if(rec[c-'a']%k==1){
                cur+=k-1;
            }else{
                cur--;
            }
            int r=n-i-1;
            if(cur>r){
                //回退，先检查当前位+1，在检查其他出现过的字母
                for(;i>=0;i--){
                    char ch=str.charAt(i);
                    rec[ch-'a']--;
                    if(rec[ch-'a']%k==0)cur-=k-1;
                    else{
                        cur++;
                    }
                    //检查当前字母-1
                    if(ch!='z'){
                        char ch2=(char)(ch+1);
                        rec[ch2-'a']++;
                        if(rec[ch2-'a']%k==1){
                            cur+=k-1;
                        }else{
                            cur--;
                        }
                        int r2=n-i-1;
                        if(cur<=r2){
                            generate(n, k, str, sb, rec, i, ch2-'a');
                            return;
                        }
                        rec[ch2-'a']--;
                        if(rec[ch2-'a']%k==0)cur-=k-1;
                        else{
                            cur++;
                        }
                    }
                    //其他字母
                    int l=-1;
                    for(int j=25;j>=0;j--){
                        if(rec[j]%k!=0&&j>ch-'a'){
                            l=j;
                        }
                    }
                    if(l!=-1){
                        rec[l]++;
                        generate(n, k, str, sb, rec, i, l);
                        return;
                    }
                }
                return;
            }
        }
        out.println(str);
    }

    private void generate(int n, int k, String str, StringBuilder sb, int[] rec, int i, int l) {
        sb.append(str.substring(0,i));
        sb.append((char)('a'+l));
        StringBuilder sb2=new StringBuilder();
        for(int j=0;j<26;j++){
            for(;rec[j]%k!=0;rec[j]++){
                sb2.append((char)('a'+j));
            }
        }
        while(sb.length()+sb2.length()<n){
            sb.append('a');
        }
        sb.append(sb2.toString());
        out.println(sb.toString());
    }


    //input
    @SuppressWarnings("unused")
    private ArrayList<Integer>[] ng(int n, int m) {
        ArrayList<Integer>[] graph=(ArrayList<Integer>[])new ArrayList[n];
        for(int i=0;i<n;i++) {
            graph[i]=new ArrayList<>();
        }
        for(int i=1;i<=m;i++) {
            int s=in.nextInt()-1,e=in.nextInt()-1;
            graph[s].add(e);
            graph[e].add(s);
        }
        return graph;
    }

    private ArrayList<long[]>[] ngw(int n, int m) {
        ArrayList<long[]>[] graph=(ArrayList<long[]>[])new ArrayList[n];
        for(int i=0;i<n;i++) {
            graph[i]=new ArrayList<>();
        }
        for(int i=1;i<=m;i++) {
            long s=in.nextLong()-1,e=in.nextLong()-1,w=in.nextLong();
            graph[(int)s].add(new long[] {e,w});
            graph[(int)e].add(new long[] {s,w});
        }
        return graph;
    }

    private int ni() {
        return in.nextInt();
    }

    private long nl() {
        return in.nextLong();
    }

    private String ns() {
        return in.next();
    }

    private long[] na(int n) {
        long[] A=new long[n];
        for(int i=0;i<n;i++) {
            A[i]=in.nextLong();
        }
        return A;
    }
    private int[] nia(int n) {
        int[] A=new int[n];
        for(int i=0;i<n;i++) {
            A[i]=in.nextInt();
        }
        return A;
    }
}

class FastReader
{
    BufferedReader br;
    StringTokenizer st;

    public FastReader()
    {
        br=new BufferedReader(new InputStreamReader(System.in));
    }


    public String next()
    {
        while(st==null || !st.hasMoreElements())//回车，空行情况
        {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    public int nextInt()
    {
        return Integer.parseInt(next());
    }

    public long nextLong()
    {
        return Long.parseLong(next());
    }
}