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 Current;

import java.util.*;

public class test {
    static final long mod = (long) 1e9 + 7;

    static class pair {
        int x, y;

        public pair(int x, int y) {
            this.x = x;
            this.y = y;
        }
    }

    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        int t = 1;
        t = sc.nextInt();
        while (t-- > 0) {
            // Start code
            int n = sc.nextInt();
            int k = sc.nextInt();
            String s = sc.next();

            if (n % k != 0) {
                println(-1);
                continue;
            }
            int a[] = new int[26];
            for (char ch : s.toCharArray()) {
                a[ch - 'a']++;
            }
            int g = 1;
            for (int i = 0; i < 26; i++)
                if (a[i] % k != 0) {
                    g = 0;
                    break;
                }

            if (g == 1) {
                println(s);
                continue;
            }
            int i;
            char ch = 'a';
            int ext = 0;
            for (i = n - 1; i >= 0; i--) {
                int id = s.charAt(i) - 'a';
                a[id]--;
                int f = 0;
                for (int j = id + 1; j < 26; j++) {
                    a[j]++;
                    int cnt = 0;
                    for (int l = 0; l < 26; l++) {
                        cnt += ((a[l] % k == 0) ? 0 : k - a[l] % k);
                    }
                    int left = n - i - 1;
                    if (cnt <= left && (left - cnt) % k == 0) {
                        ch = (char) (j + 97);
                        f = 1;
                        ext = left - cnt;
                        break;
                    }
                    a[j]--;
                }
                if (f == 1)
                    break;
            }
            StringBuilder res = new StringBuilder(s.substring(0, i));
            res.append(ch);
            while (ext-- > 0)
                res.append('a');

            for (char c = 'a'; c <= 'z'; c++) {
                int id = c - 'a';
                int m = ((a[id] % k == 0) ? 0 : k - a[id] % k);
                while (m-- > 0)
                    res.append(c);
            }
            println(res);
        }
        sc.close();
    }

    static void print(Object o) {
        System.out.print(o + " ");
    }

    static void println(Object o) {
        System.out.println(o);
    }

    static void swap(int arr[], int i, int j) {
        int temp = arr[i];
        arr[i] = arr[j];
        arr[j] = temp;
    }

    static ArrayList<Long> factorial(int num) {
        ArrayList<Long> fac = new ArrayList<>();
        fac.add((long) 0);
        fac.add((long) 1);

        for (int i = 2; i < num; i++) {
            fac.add((fac.get(i - 1) * i) % mod);
        }

        return fac;
    }

    static long ncr(long x, long y, ArrayList<Long> fac) {
        if (y >= x)
            return (long) 1;

        long res = fac.get((int) x);
        long z = (fac.get((int) y) * fac.get((int) (x - y))) % mod;
        z = modInv(z);
        res = (res * z) % mod;
        return res;
    }

    static long modInv(long x) {
        return modExpo(x, mod - 2);
    }

    static long modExpo(long x, long y) {
        long res = 1;
        x = x % mod;
        while (y > 0) {
            if (y % 2 == 1)
                res = (res * x) % mod;
            y = y / 2;
            x = (x * x) % mod;
        }
        return res;
    }

    static int lowerBound(int n, long[] arr, long value) {
        int res = (int) 1e7;
        int l = 0, r = n - 1;
        while (l <= r) {
            int mid = l + (r - l) / 2;
            if (arr[mid] >= value) {
                res = mid;
                r = mid - 1;
            } else
                l = mid + 1;
        }
        return res;
    }
}
