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 {
    static FastScanner sc = new FastScanner(System.in);
    static PrintWriter pw = new PrintWriter(System.out);
    static StringBuilder sb = new StringBuilder();
    static int[] cnt = new int[26];

    public static void main(String[] args) throws Exception {
        int n = sc.nextInt();
        for(int i = 0; i < n; i++) solve();
        pw.flush();
    }
    
    public static void solve(){
        int n = sc.nextInt();
        int k = sc.nextInt();
        char[] s = sc.next().toCharArray();
        Arrays.fill(cnt,0);
        for (char c : s) cnt[c - 'a']++;

        int sum = 0;
        
        for (int i = 0; i < 26; ++i) {
            sum += get(cnt[i], k);
        }
        if (sum == 0) {
            pw.println(new String(s));
            return;
        }

        if (n % k != 0) {
            pw.println(-1);
            return;
        }
        
        for (int i = n - 1; i >= 0; --i) {
            sum -= get(cnt[s[i] - 'a'], k);
            cnt[s[i] - 'a']--;
            sum += get(cnt[s[i] - 'a'], k);
            for (int j = s[i] - 'a' + 1; j < 26; ++j) {
                int lst_sum = sum;
                sum -= get(cnt[j], k);
                cnt[j]++;
                sum += get(cnt[j], k);

                if (i + sum + 1 <= n) {
                    for (int pos = 0; pos < i; ++pos) {
                        pw.print(s[pos]);
                    }
                    pw.print((char)('a' + j));
                    for (int w = 0; w < 26; ++w) {
                        int f = get(cnt[w], k);
                        while (f > 0) {
                            f--;
                            sb.append((char)('a' + w));
                        }
                    }
                    while (sb.length() + i + 1 < n) {
                        sb.append("a");
                    }
                    char[] ads = sb.toString().toCharArray();
                    Arrays.sort(ads);
                    sb.setLength(0);
                    pw.println(new String(ads));
                    return;
                }
                cnt[j]--;
                sum = lst_sum;
            }
        }
        pw.println(-1);
        return;
    }
    
    public static int get(int x, int k){
        return (k - x % k) % k;
    }
    
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

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

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

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

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

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

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    }
}
