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.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;

import static java.lang.Math.*;

public class Main
{
    static final int mod = (int)1e9 + 7;
    static final int MAX = (int)2e5;
    public static void main(String[] args) throws Exception
    {
        FastReader in = new FastReader();
        PrintWriter out = new PrintWriter(System.out);
        int test = in.nextInt();
        while(test-- > 0)
        {
            int n = in.nextInt();
            int k = in.nextInt();
            char[] s = in.next().toCharArray();
            if(n % k != 0) {
                out.println(-1);
                continue;
            }
            int[] freqMod = new int[26];
            for(int i = 0; i < n; i++) {
                freqMod[s[i] - 'a']++;
                freqMod[s[i] - 'a'] %= k;
            }
            int idx = -1;
            int c = -1;
            for(int i = n - 1; i >= 0; i--) {
                freqMod[s[i] - 'a'] = (freqMod[s[i] - 'a'] - 1 + k) % k;
                int j = s[i] - 'a' + (i == n - 1 ? 0 : 1);
                for(; j < 26; j++) {
                    freqMod[j]++;
                    freqMod[j] %= k;
                    int sum = 0;
                    for(int i1 = 0; i1 < 26; i1++) {
                        sum += (k - freqMod[i1]) % k;
                    }
                    if(sum <= n - i - 1 && ((n - i - 1) - sum) % k == 0) {
                        idx = i;
                        c = j;
                        break;
                    }
                    freqMod[j] = (freqMod[j] - 1 + k) % k;
                }
                if(idx != -1) {
                    break;
                }
            }
            if(idx == -1) {
                out.println(-1);
                continue;
            }
            int p = n - 1;
            for(int i = 25; i >= 0; i--) {
                char ch = (char)('a' + i);
                int r = (k - freqMod[i]) % k;
                while (r-- > 0) {
                    s[p] = ch;
                    p--;
                }
            }
            while (p > idx) {
                s[p] = 'a';
                p--;
            }
            s[idx] = (char)('a' + c);
            out.println(s);
        }
        out.flush();
    }
}

class FastReader
{
    BufferedReader br;
    StringTokenizer st;

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

    public String next() throws IOException
    {
        if(st == null || !st.hasMoreElements())
        {
            st = new StringTokenizer(br.readLine());
        }

        return st.nextToken();
    }

    public boolean hasNext() throws IOException
    {
        if(st != null && st.hasMoreElements())
        {
            return true;
        }

        String s = br.readLine();
        if(s == null) {
            return false;
        }

        st = new StringTokenizer(s);

        return st.hasMoreElements();
    }

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

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

    public String nextLine() throws IOException
    {
        return br.readLine();
    }
}