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

//package codeforces.round705div2;

import java.io.*;
import java.util.StringTokenizer;

public class C_BeautifulStrings {
    public void solution() throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        StringTokenizer st;

        int TC = Integer.parseInt(br.readLine());
        for (int test = 0; test < TC; test++) {
            st = new StringTokenizer(br.readLine());
            int n = Integer.parseInt(st.nextToken());
            int k = Integer.parseInt(st.nextToken());
            String s = br.readLine();

            if (n % k != 0) {
                bw.write("-1\n");
                continue;
            }

            StringBuffer sb = new StringBuffer(s.substring(0, s.length() - 1));
            sb.append((char) (s.charAt(s.length() - 1) + 1));
            if (isValid(sb.toString(), s.length() - 1, k)) {
                bw.write(s);
                bw.newLine();
                continue;
            }

            int changeIdx = binarySearch(s, 0, s.length() - 1, k);
            bw.write(makeString(s, changeIdx, k));
            bw.newLine();
            bw.flush();
        }
        br.close();
        bw.close();
    }

    public int binarySearch(String s, int start, int end, int k) {
        if (start == end) {
            if (isValid(s, start, k)) {
                return start;
            } else {
                return start - 1;
            }
        }

        int mid = (start + end) / 2;
        if (isValid(s, mid, k)) {
            return binarySearch(s, mid + 1, end, k);
        } else {
            return binarySearch(s, start, mid, k);
        }
    }

    public boolean isValid(String s, int idx, int k) {
        int[] alpha = new int[28];
        int avail = s.length() / k;
        for (int i = 0; i <= idx; i++) {
            int ch = s.charAt(i) - 'a';
            if (idx == i) {
                ch++;
            }
            if (alpha[ch] == 0) {
                alpha[ch]++;
                avail--;
            } else {
                alpha[ch]++;
                if (alpha[ch] == k) {
                    alpha[ch] = 0;
                }
            }
            if (avail < 0) {
                return false;
            }
        }
        return true;
    }

    public String makeString(String s, int idx, int k) {
        StringBuffer sb = new StringBuffer(s.substring(0, idx));
        sb.append((char) (s.charAt(idx) + 1));
        int[] alpha = new int[28];
        int avail = s.length() / k;

        for (int i = 0; i <= idx; i++) {
            int ch = sb.charAt(i) - 'a';
            if (alpha[ch] == 0) {
                alpha[ch]++;
                avail--;
            } else {
                alpha[ch]++;
                if (alpha[ch] == k) {
                    alpha[ch] = 0;
                }
            }
        }
        StringBuffer rearString = new StringBuffer();
        for (int i = 0; i < alpha.length; i++) {
            if (alpha[i] != 0) {
                for (int j = alpha[i]; j < k; j++) {
                    rearString.append((char) ('a' + i));
                }
            }
        }
        StringBuffer midString = new StringBuffer();
        for (int i = 0; i < avail; i++) {
            for (int j = 0; j < k; j++) {
                midString.append('a');
            }
        }
        return sb.append(midString).append(rearString).toString();
    }

    public static void main(String[] args) throws IOException {
        C_BeautifulStrings c = new C_BeautifulStrings();
        c.solution();
    }
}
