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.List;
import java.util.Scanner;

public class Q3 {

    private interface Solution {
        void run(int t);
    }

    private static final boolean IS_MULTITASK = true;
    private static final boolean IS_ISOLATED = true;

    private static final Scanner in = new Scanner(System.in);

    public static void main(String[] args) {
        Solution s = getAndInitSolution();
        if (IS_MULTITASK) {
            multiTask(s);
        } else {
            singleTask(s);
        }
    }

    private static void multiTask(Solution s) {
        int t = in.nextInt();
        in.nextLine();

        for (int i = 0; i < t; i++) {
            s.run(t);
        }
    }

    private static void singleTask(Solution s) {
        s.run(-1);
    }

    private static Solution getAndInitSolution() {
        if (IS_ISOLATED) {
            return t -> new IsolateSolution().run(t);
        } else {
            PreComputedSolution preComputedSolution = new PreComputedSolution();
            preComputedSolution.init();
            return preComputedSolution;
        }
    }

    private static class IsolateSolution implements Solution {

        private static final int ALPH_SIZE = 'z' - 'a' + 1;

        String s;
        int n, k;
        int[] vals;

        @Override
        public void run(int t) {
            init();
            prepare();
            solve();
        }

        private void init() {
            n = in.nextInt();
            k = in.nextInt();
            in.nextLine();

            s = in.nextLine();
        }

        private void prepare() {
            vals = new int[n];
            char[] carr = s.toCharArray();
            for (int i = 0; i < n; i++) {
                vals[i] = carr[i] - 'a';
            }
        }

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

            if (checkExisting()) {
                System.out.println(s);
                return;
            }

            String ans = calculate();

            if (ans == null) {
                System.out.println(-1);
                return;
            }

            System.out.println(ans);
        }



        private String calculate() {
            int start = 0;
            int end = n - 1;
            int o = -1;

            while (start <= end) {
                int m = (start + end) / 2;

                if (constructTheRest(m) != null) {
                    o = m;
                    start = m + 1;
                } else {
                    end = m - 1;
                }
            }

            if (o == -1)
                return null;

            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < o; i++) {
                sb.append((char) ('a' + vals[i]));
            }
            sb.append(constructTheRest(o));
            return sb.toString();
        }

        int[] reps = new int[ALPH_SIZE];

        private boolean checkExisting() {
            for (int i = 0; i < ALPH_SIZE; i++) {
                reps[i] = 0;
            }

            for (int i = 0; i < n; i++) {
                reps[vals[i]]++;
            }

            for (int i = 0; i < ALPH_SIZE; i++) {
                if (reps[i] % k != 0) {
                    return false;
                }
            }

            return true;
        }

        private String constructTheRest(int p) {
            for (int i = 0; i < ALPH_SIZE; i++) {
                reps[i] = 0;
            }

            for (int i = 0; i < p; i++) {
                reps[vals[i]]++;
            }

            int min = ALPH_SIZE;
            int minNotK = ALPH_SIZE;
            for (int i = 0; i < p; i++) {
                if (vals[i] > vals[p]) {
                    min = Math.min(min, vals[i]);
                    if (reps[vals[i]] % k != 0) {
                        minNotK = Math.min(minNotK, vals[i]);
                    }
                }
            }

            String ans1 = tryFixing(p, min);
            if (ans1 != null)
                return ans1;
            String ans2 = tryFixing(p, minNotK);
            if (ans2 != null)
                return ans2;
            String ans3 = tryFixing(p, vals[p] + 1);
            if (ans3 != null)
                return ans3;
            return null;
        }

        private String tryFixing(int p, int val) {
            if (val >= ALPH_SIZE)
                return null;

            int[] reps2 = reps;
            StringBuilder sb = new StringBuilder();

            sb.append((char) ('a' + val));
            reps2[val]++;
            for (int i = 0; i < ALPH_SIZE; i++) {
                while (reps2[i] % k != 0) {
                    sb.append((char) ('a' + i));
                    reps2[i]++;
                }
            }

            int l = sb.length();
            if (p + l > n)
                return null;

            int d = n - (p + l);
            while(d > 0) {
                sb.append('a');
                d--;
            }

            return sb.toString();
        }
    }

    private static class PreComputedSolution implements Solution {

        public void init() {
            //TODO:
            System.out.println("Init world!");
        }

        @Override
        public void run(int t) {
            //TODO:
            System.out.println("Hello world!");
        }
    }



}
