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.util.*;

/*
1
16 8
cadjfdsljfdkljds

1
7 7
daaaaaa

 */
public class problemC {
    static class Solution {
        static final int C = 26;
        void solve() {
            int n = fs.nextInt(), k = fs.nextInt();
            char[] S = fs.next().toCharArray();

            if (n % k != 0) { out.println(-1); return ; }

            short[] s = new short[n];
            for (int i = 0 ; i < n ; i ++) s[i] = (short)(S[i] - 'a');

            int[] freq = new int[C];
            for (short x : s) freq[x]++;

            boolean allGood = true;
            for (int x : freq) if (x % k != 0) allGood = false;
            if (allGood) { out.println(new String(S)); return; }

            int remain = 0;
            for (int ind = n-1; ind >= 0 ; ind--) {
                freq[s[ind]]--;

                for (int replacement = s[ind]+1 ; replacement < C ; replacement++) {
                    freq[replacement]++;
                    s[ind] = (short)replacement;
                    if (works(freq, remain, k)) {
                        print(s, ind, freq, remain, k);
                        return;
                    }
                    freq[replacement]--;
                }
                remain++;
            }
            throw null;
        }

        void print(short[] s, int ind, int[] freq, int remain, int k) {
            for (int i = 0 ; i <= ind; i ++) out.print((char)(s[i]+'a'));


            LinkedList<Short> others = new LinkedList<>();
            for (short ch = 0 ; ch < C ; ch ++ ) {
                if (freq[ch] % k == 0) continue;
                int x = freq[ch];
                int need = (((x+k-1)/k)*k) - x;
                for (int i = 0 ; i < need; i ++) others.addLast(ch);
            }
            int need = remain - others.size();
            for (int i = 0 ; i < need ; i ++) others.addLast((short)0);
            Collections.sort(others);
            for (short x : others) out.print((char)(x + 'a'));
            out.println();
        }

        boolean works(int[] freq, int remain, int k) {
            int need = 0;
            for (int x : freq) if (x != 0) need += (((x+k-1)/k)*k) - x;
            return need <= remain && (remain-need) % k == 0;
        }

    }

    public static void main(String[] args) throws Exception {
        int T = 1;
        T = fs.nextInt();
        Solution solution = new Solution();
        for (int t = 0; t < T; t++) { solution.solve(); out.flush(); }
    }

    static void debug(Object... O) {
        System.err.println("DEBUG: " + Arrays.deepToString(O));
    }

    private static FastScanner fs = new FastScanner();
    private static PrintWriter out = new PrintWriter(System.out);

    static class FastScanner { // Thanks SecondThread.
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");

        String next() {
            while (!st.hasMoreTokens())
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

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

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

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

        ArrayList<Integer> readArrayList(int n) {
            ArrayList<Integer> a = new ArrayList<>(n);
            for (int i = 0 ; i < n; i ++ ) a.add(fs.nextInt());
            return a;
        }

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

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

        String nextString() {
            return next();
        }
    }
}
