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.InputStreamReader;
import java.util.Map;
import java.util.TreeMap;

public class C {

    private static final boolean TEST_MODE = true;
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int T = getInt(br);
        for (int t=0; t<T; t++) {
            int[] val = getIntArray(2, br);
            String s = br.readLine();
            System.out.println(process(val[0], val[1], s.toCharArray()));
        }
    }

    private static String process(int N, int K, char[] s) throws Exception {
        if (N%K != 0) {
           return "-1";
        }
        int uniqDigits = N/K;
        TreeMap<Character, Integer> uniqAllowedMap = new TreeMap<>();

        char[] res = new char[N];
        for (int i=0; i<N; i++) {
            char curr = s[i];
            // Check if this element is present in the allowed map.
            if (uniqAllowedMap.containsKey(curr)) {
                res[i] = curr;
                int currCnt = uniqAllowedMap.get(curr);
                currCnt--;
                if (currCnt > 0) {
                    uniqAllowedMap.put(curr, currCnt);
                } else {
                    uniqAllowedMap.remove(curr);
                }
                continue;
            }
            // Not present in allowed map. See if we can add this to uniques.
            if (uniqDigits > 0) {
                uniqDigits--;
                if (K - 1 > 0) {
                    uniqAllowedMap.put(curr, K - 1);
                }
                res[i] = curr;
                continue;
            }
            // See if we can assign a higher character.
            Character higherPoss = uniqAllowedMap.higherKey(curr);
            if (higherPoss != null) {
                res[i] = higherPoss;
                int currCnt = uniqAllowedMap.get(higherPoss);
                currCnt--;
                if (currCnt > 0) {
                    uniqAllowedMap.put(higherPoss, currCnt);
                } else {
                    uniqAllowedMap.remove(higherPoss);
                }
                // Fill rest of letters greedily from allowed map, smallest to largest.
                for (int greedyI = i+1; greedyI<N; ) {
                    Map.Entry<Character, Integer> currHead = uniqAllowedMap.firstEntry();
                    int greedyCnt = currHead.getValue();
                    for (int currHeadCnt = 0; currHeadCnt < greedyCnt; currHeadCnt++) {
                        res[greedyI] = currHead.getKey();
                        greedyI++;
                    }
                    uniqAllowedMap.remove(currHead.getKey());
                }
                break;
            }
            // No choice but to assign smaller character.
            // We will increment some higher character.
            int higherI = i-1;
            for ( ; higherI >= 0; higherI--) {
                if (res[higherI] != 'z') {
                    res[higherI]++;
                    break;
                }
            }
            // Fill remaining with 'a'.
            for (int greedyI = higherI + 1; greedyI < N; greedyI++) {
                res[greedyI] = 'a';
            }
            return process(N, K, res);
        }
        return new String(res);
    }

    private static Integer getInt(BufferedReader br) throws Exception {
        return Integer.parseInt(br.readLine());
    }

    private static Long getLong(BufferedReader br) throws Exception {
        return Long.parseLong(br.readLine());
    }

    private static int[] getIntArray(int N, BufferedReader br) throws Exception {
        String s = br.readLine();
        String[] tokens = s.split(" ");
        int[] result = new int[N];

        for (int i=0; i<N; i++) {
            result[i] = Integer.parseInt(tokens[i]);
        }
        return result;
    }

    private static long[] getLongArray(int N, BufferedReader br) throws Exception {
        String s = br.readLine();
        String[] tokens = s.split(" ");
        long[] result = new long[N+1];

        for (int i=0; i<N; i++) {
            result[i+1] = Long.parseLong(tokens[i]);
        }
        return result;
    }

    private static void printArray(String message, Object[] arr) {
        if (!TEST_MODE) {
            return;
        }
        System.out.print(message + " : ");
        for (int i=0; i<arr.length; i++) {
            System.out.print(arr[i] + " ");
        }
        System.out.println();
    }
}