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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.util.*;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/*
@author kalZor
 */
public class TaskC {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Solver solver = new Solver();
        int testCount = Integer.parseInt(in.next());
        for (int i = 1; i <= testCount; i++)
            solver.solve(i, in, out);
        out.close();
    }

    static class Solver {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            int n = in.nextInt(),k = in.nextInt();
            String s = in.next();
            char[] a = s.toCharArray();
            if(n%k!=0){
                out.println(-1);
                return;
            }
            int[] cnt = new int[26];
            for(int i=0;i<a.length;i++){
                cnt[a[i]-'a']++;
            }
            boolean poss = true;
            for(int i=0;i<26;i++){
                if(cnt[i]>0){
                    if(cnt[i]%k!=0) poss = false;
                }
            }
            if(poss){
                out.println(s);
                return;
            }
            else{
                int cntLen = 0;
                int cntReq = 0;
                for(int j=0;j<26;j++){
                    cntReq += (k-cnt[j]%k)%k;
                }
                for(int i=n-1;i>=0;i--){
                    int currSum = cntReq;
                    currSum -= (k-cnt[a[i]-'a']%k)%k;
                    cnt[a[i]-'a']--;
                    currSum +=  (k-cnt[a[i]-'a']%k)%k;
                    for(int j=a[i]-'a'+1;j<26;j++) {
                        currSum -=  (k-cnt[j]%k)%k;
                        currSum +=  (k-(cnt[j]+1)%k)%k;
                        if(i+currSum<=n-1){
                            StringBuilder ans = new StringBuilder();
                            for(int ind=0;ind<i;ind++) ans.append(a[ind]);
                            ans.append((char) ('a'+j));
                            cnt[j]++;
                            ArrayList<Character> ans2 = new ArrayList<Character>();
                            for(int ind=0;ind<26;ind++){
                                int loop = (k-cnt[ind]%k)%k;
                                while(loop>0){
                                    ans2.add((char) ('a'+ind));
                                    loop--;
                                }
                            }
                            while(ans.length()+ans2.size()<n)ans2.add('a');
                            Collections.sort(ans2);
                            for(char c:ans2) ans.append(c);
                            out.println(ans);
                            return;
                        }
                        currSum -=  (k-(cnt[j]+1)%k)%k;
                        currSum +=  (k-cnt[j]%k)%k;
                    }
                    cntReq = currSum;
                }
            }
        }
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader(InputStream stream){
            br = new BufferedReader(new
                InputStreamReader(stream));
        }

        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());
        }

        public double nextDouble(){
            return Double.parseDouble(next());
        }

        public String nextLine(){
            String str = "";
            try{
                str = br.readLine();
            }
            catch (IOException e){
                e.printStackTrace();
            }
            return str;
        }

        public int[] nextArray(int n) {
            int[] a=new int[n];
            for (int i=0; i<n; i++) a[i]=nextInt();
                return a;
        }
    }
}

