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

public final class Solution {

    static PrintWriter out = new PrintWriter(System.out);
    static FastReader in = new FastReader();
    static long mod = (long) 1e9 + 7;
    static Pair[] moves = new Pair[]{new Pair(-1, 0), new Pair(1, 0), new Pair(0, -1), new Pair(0, 1)};

    //You are given a string 𝑠 consisting of lowercase English letters and a number 𝑘. Let's call a string consisting of lowercase English letters beautiful if the number of occurrences of each letter in that string is divisible by 𝑘. You are asked to find the lexicographically smallest beautiful string of length 𝑛, which is lexicographically greater or equal to string 𝑠. If such a string does not exist, output −1.
    //
    //A string 𝑎 is lexicographically smaller than a string 𝑏 if and only if one of the following holds:
    //
    //𝑎 is a prefix of 𝑏, but 𝑎≠𝑏;
    //in the first position where 𝑎 and 𝑏 differ, the string 𝑎 has a letter that appears earlier in the alphabet than the corresponding letter in 𝑏.

    //4
    //4 2
    //abcd
    //3 1
    //abc
    //4 3
    //aaaa
    //9 3
    //abaabaaaa

    //acac
    //abc
    //-1
    //abaabaaab

    //aacccc
    //aadadd

    public static void main(String[] args) {
        int t = i();

        out:
        while (t-- > 0) {
            int n = i();
            int k = i();

            String s = s();

            if (n % k > 0) {
                out.println(-1);
                continue;
            }

            int[] cnt = new int[26];
            for (char c : s.toCharArray()) {
                cnt[c - 'a']++;
            }

            int m = n / k;
            int cc = getCC(cnt, k);

            if (m == cc) {
                out.println(s);
                continue;
            }

            for (int i = n - 1; i >= 0; i--) {
                int c = s.charAt(i) - 'a';
                cnt[c]--;

                if (c == 25) {
                    continue;
                }
                cnt[c + 1]++;

                cc = getCC(cnt, k);
                if (cc <= m) {
                    char[] cs = s.toCharArray();
                    int idx = i;
                    cs[idx++] = (char) ('a' + c + 1);
                    for (int j = 0; j < m - cc; j++) {
                        for (int kk = 0; kk < k; kk++) {
                            cs[idx++] = 'a';
                        }
                    }

                    for (int j = 0; j < 26; j++) {
                        int mod = cnt[j] % k;
                        if (mod > 0) {
                            for (int kk = 0; kk < k - mod; kk++) {
                                cs[idx++] = (char) ('a' + j);
                            }
                        }
                    }
                    out.println(new String(cs));
                    continue out;
                } else {
                    cnt[c + 1]--;
                }
            }

            out.println(-1);
        }
        out.flush();
    }

    private static int getCC(int[] cnt, int k) {
        int ans = 0;
        for (int i = 0; i < 26; i++) {
            int mod = cnt[i] % k;
            ans += cnt[i] / k + (mod > 0 ? 1 : 0);
        }
        return ans;
    }

    static boolean isPS(double number) {
        double sqrt = Math.sqrt(number);
        return ((sqrt - Math.floor(sqrt)) == 0);
    }

    static int sd(long i) {
        int d = 0;
        while (i > 0) {
            d += i % 10;
            i = i / 10;
        }
        return d;
    }

    /*static int[] leastPrime;

    static void sieveLinear(int N) {
        int[] primes = new int[N];
        int idx = 0;
        leastPrime = new int[N + 1];
        for (int i = 2; i <= N; i++) {
            if (leastPrime[i] == 0) {
                primes[idx++] = i;
                leastPrime[i] = i;
            }
            int curLP = leastPrime[i];
            for (int j = 0; j < idx; j++) {
                int p = primes[j];
                if (p > curLP || (long) p * i > N) {
                    break;
                } else {
                    leastPrime[p * i] = p;
                }
            }
        }
    }*/


    static int lower(long A[], long x) {
        int l = -1, r = A.length;
        while (r - l > 1) {
            int m = (l + r) / 2;
            if (A[m] >= x) {
                r = m;
            } else {
                l = m;
            }
        }
        return r;
    }

    static int upper(long A[], long x) {
        int l = -1, r = A.length;
        while (r - l > 1) {
            int m = (l + r) / 2;
            if (A[m] <= x) {
                l = m;
            } else {
                r = m;
            }
        }
        return l;
    }

    static void swap(int A[], int a, int b) {
        int t = A[a];
        A[a] = A[b];
        A[b] = t;
    }

    static int lowerBound(int A[], int low, int high, int x) {
        if (low > high) {
            if (x >= A[high]) {
                return A[high];
            }
        }

        int mid = (low + high) / 2;

        if (A[mid] == x) {
            return A[mid];
        }

        if (mid > 0 && A[mid - 1] <= x && x < A[mid]) {
            return A[mid - 1];
        }

        if (x < A[mid]) {
            return lowerBound(A, low, mid - 1, x);
        }

        return lowerBound(A, mid + 1, high, x);
    }


    static long pow(long a, long b) {
        long pow = 1;
        long x = a;
        while (b != 0) {
            if ((b & 1) != 0) {
                pow = (pow * x) % mod;
            }
            x = (x * x) % mod;
            b /= 2;
        }
        return pow;
    }

    static boolean isPrime(long N) {
        if (N <= 1) {
            return false;
        }
        if (N <= 3) {
            return true;
        }
        if (N % 2 == 0 || N % 3 == 0) {
            return false;
        }
        for (int i = 5; i * i <= N; i = i + 6) {
            if (N % i == 0 || N % (i + 2) == 0) {
                return false;
            }
        }
        return true;
    }

    static void print(char A[]) {
        for (char c : A) {
            out.print(c);
        }
        out.println();
    }

    static void print(boolean A[]) {
        for (boolean c : A) {
            out.print(c + " ");
        }
        out.println();
    }

    static void print(int A[]) {
        for (int c : A) {
            out.print(c + " ");
        }
        out.println();
    }

    static void print(long A[]) {
        for (long i : A) {
            out.print(i + " ");
        }
        out.println();

    }

    static void print(List<Integer> A) {
        for (int a : A) {
            out.print(a + " ");
        }
    }

    static void printYes() {
        out.println("YES");
    }

    static void printNo() {
        out.println("NO");
    }

    static int i() {
        return in.nextInt();
    }

    static long l() {
        return in.nextLong();
    }

    static String s() {
        return in.nextLine();
    }

    static int[] input(int N) {
        int A[] = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = in.nextInt();
        }
        return A;
    }

    static long[] inputLong(int N) {
        long A[] = new long[N];
        for (int i = 0; i < A.length; i++) {
            A[i] = in.nextLong();
        }
        return A;
    }

    static int GCD(int a, int b) {
        if (b == 0) {
            return a;
        } else {
            return GCD(b, a % b);
        }
    }

    static long GCD(long a, long b) {
        if (b == 0) {
            return a;
        } else {
            return GCD(b, a % b);
        }
    }

}

class BIT {

    int n;
    int[] tree;

    public BIT(int n) {
        this.n = n;
        this.tree = new int[n + 1];
    }

    public static int lowbit(int x) {
        return x & (-x);
    }

    public void update(int x) {
        while (x <= n) {
            ++tree[x];
            x += lowbit(x);
        }
    }

    public int query(int x) {
        int ans = 0;
        while (x > 0) {
            ans += tree[x];
            x -= lowbit(x);
        }
        return ans;
    }

    public int query(int x, int y) {
        return query(y) - query(x - 1);
    }
}

class SegmentTree {

    long[] t;

    public SegmentTree(int n) {
        t = new long[n + n];
        Arrays.fill(t, Long.MIN_VALUE);
    }

    public long get(int i) {
        return t[i + t.length / 2];
    }

    public void add(int i, long value) {
        i += t.length / 2;
        t[i] = value;
        for (; i > 1; i >>= 1) {
            t[i >> 1] = Math.max(t[i], t[i ^ 1]);
        }
    }

    // max[a, b]
    public long max(int a, int b) {
        long res = Long.MIN_VALUE;
        for (a += t.length / 2, b += t.length / 2; a <= b; a = (a + 1) >> 1, b = (b - 1) >> 1) {
            if ((a & 1) != 0) {
                res = Math.max(res, t[a]);
            }
            if ((b & 1) == 0) {
                res = Math.max(res, t[b]);
            }
        }
        return res;
    }
}

class Pair {

    int i, j;

    Pair(int i, int j) {
        this.i = i;
        this.j = j;
    }
}

class FastReader {

    BufferedReader br;
    StringTokenizer st;

    public FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

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

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

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

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

    String nextLine() {
        String str = "";
        try {
            str = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
    }


}
