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 char[] alps = "abcdefghijklmnopqrstuvwxyz".toCharArray();

    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();
        int per = n/k;
        TreeMap<Character,Integer> map = new TreeMap<>(Comparator.reverseOrder());
        
        for(int i = 0; i < n; i++){
            map.put(s[i],map.getOrDefault(s[i],0)+1);
        }
        for(int i = n; i >= 0; i--){
            int diff = 0;
            boolean flg = true;
            int j = n-1;
            //pw.println(new String(s));
            //pw.println(map);
            for(Map.Entry<Character,Integer> e : map.entrySet()){
                char c = e.getKey();
                if(e.getValue() % k == 0) continue;
                int v = k-(e.getValue() % k);
                while(j > i && v != 0){
                    s[j] = c;
                    j--;
                    v--;
                }
                if(v != 0){
                    flg = false;
                    break;
                }
            }
            if(flg){
                int v = 0;
                while(j > i){
                    s[j] = 'a';
                    j--;
                    v++;
                }
                if(v % k == 0){
                    pw.println(new String(s));
                    return;
                }
            }
            if(i != n){
                int v = map.getOrDefault(s[i],0);
                if(map.get(s[i]) <= 1){
                    map.remove(s[i]);
                }else{
                    map.put(s[i],v-1);
                }
            }
            diff = 0;
            flg = true;
            j = n-1;
            //pw.println(new String(s));
            //pw.println(map);
            for(Map.Entry<Character,Integer> e : map.entrySet()){
                char c = e.getKey();
                if(e.getValue() % k == 0) continue;
                int v = k-(e.getValue() % k);
                while(j > i-1 && v != 0 && s[i-1] >= s[j]){
                    s[j] = c;
                    j--;
                    v--;
                }
                if(v != 0){
                    flg = false;
                    break;
                }
            }
            if(flg){
                if(j - i+1 == 0){
                    pw.println(new String(s));
                    return;
                }
            }
            if(i != 0){
                int v = map.getOrDefault(s[i-1],0);
                if(map.get(s[i-1]) <= 1){
                    map.remove(s[i-1]);
                }else{
                    map.put(s[i-1],v-1);
                }
                s[i-1] = alps[Math.min((s[i-1]-'a'+1),25)];
                map.put(s[i-1],map.getOrDefault(s[i-1],0)+1);
            }
        }
        pw.println(-1);
    }

    static class GeekInteger {
        public static void save_sort(int[] array) {
            shuffle(array);
            Arrays.sort(array);
        }

        public static int[] shuffle(int[] array) {
            int n = array.length;
            Random random = new Random();
            for (int i = 0, j; i < n; i++) {
                j = i + random.nextInt(n - i);
                int randomElement = array[j];
                array[j] = array[i];
                array[i] = randomElement;
            }
            return array;
        }

        public static void save_sort(long[] array) {
            shuffle(array);
            Arrays.sort(array);
        }

        public static long[] shuffle(long[] array) {
            int n = array.length;
            Random random = new Random();
            for (int i = 0, j; i < n; i++) {
                j = i + random.nextInt(n - i);
                long randomElement = array[j];
                array[j] = array[i];
                array[i] = randomElement;
            }
            return array;
        }

    }
    
    private static long gcd(long a, long b)
{
    while (b > 0)
    {
        long temp = b;
        b = a % b; // % is remainder
        a = temp;
    }
    return a;
}

private static long gcd(long[] input)
{
    long result = input[0];
    for(int i = 1; i < input.length; i++)
    {
        result = gcd(result, input[i]);
    }
    return result;
}

private static long lcm(long a, long b)
{
    return a * (b / gcd(a, b));
}

private static long lcm(long[] input)
{
    long result = input[0];
    for(int i = 1; i < input.length; i++)
    {
        result = lcm(result, input[i]);
    }
    return result;
}
}

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