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 {
    public static MyScanner scanner = new MyScanner(System.in);
    public static PrintWriter out = new PrintWriter(System.out);
    
    private static void handle() throws IOException {
        SampleReader sampleReader = SampleReader.of(scanner);
        SampleHandler sampleHandler = SampleHandler.of(sampleReader);
        
        sampleHandler.outputResult(out);
        out.flush();
    }
    
    public static void main(String[] args) throws IOException {
        int n = scanner.nextInt();
        for (int i = 0; i < n; ++i) {
            handle();
        }
    }
}

class MyScanner {
    private final BufferedReader br;
    private StringTokenizer st;
    
    public MyScanner(InputStream is) {
        this.br = new BufferedReader(new InputStreamReader(is));
    }
    
    public String next() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null) {
                    return null;
                }
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return st.nextToken();
    }
    
    public int nextInt() {
        return Integer.parseInt(next());
    }
    
    public long nextLong() {
        return Long.parseLong(next());
    }
}

class SampleReader {
    public final int n, k;
    public final String s;
    //public final List<Integer> digitList;
    
    public SampleReader(int n, int k, String s) {
        this.n = n;
        this.k = k;
        this.s = s;
        //this.digitList = Collections.unmodifiableList(digitList);
    }
    
    public static SampleReader of(MyScanner scanner) {
        return new SampleReader(scanner.nextInt(), scanner.nextInt(), scanner.next());
    }
}


class SampleHandler {
    private String answer;
    
    public SampleHandler(String answer) {
       this.answer = answer;
    }
    
    private static String getExistingAnswer(SampleReader sr) {
        int[] charFreq = new int[26];
        for (int i = 0; i < sr.n; ++i) {
            ++charFreq[sr.s.charAt(i) - 'a'];
        }
        
        int needToAdd = 0;
        for (int i = 0; i < 26; ++i) {
            needToAdd += (sr.k - charFreq[i] % sr.k) % sr.k;
        }
        if (needToAdd == 0) {
            return sr.s;
        }
        
        StringBuilder answer = new StringBuilder("-1");
        
        class Remainder {
            public int get(int a) {
                return (sr.k - (a % sr.k)) % sr.k;
            }
        }
        Remainder r = new Remainder();
        
        deepLoop:
        for (int start = sr.s.length() - 1; start >= 0; --start) {
            char c = sr.s.charAt(start);
            needToAdd -= r.get(charFreq[c - 'a']);
            needToAdd += r.get(charFreq[c - 'a'] - 1);
            --charFreq[c - 'a'];
            
            for (char beginning = (char)(c + 1); beginning <= 'z'; ++beginning) {
                needToAdd -= r.get(charFreq[beginning - 'a']);
                needToAdd += r.get(charFreq[beginning - 'a'] + 1);
                ++charFreq[beginning - 'a'];
                
                if (needToAdd <= sr.s.length() - start - 1) {
                    StringBuilder ans = new StringBuilder();
                    for (int i = 0; i < start; ++i) {
                        ans.append(sr.s.charAt(i));
                    }
                    ans.append(beginning);
                    int freeChars = sr.s.length() - start - needToAdd - 1;
                    for (int i = 0; i < freeChars; ++i) {
                        ans.append('a');
                    }
                    
                    for (int i = 0; i < 26; ++i) {
                        for (int j = 0; j < r.get(charFreq[i]); ++j) {
                            ans.append((char)('a' + i));
                        }
                    }
                    answer = ans;
                    break deepLoop;
                    
                }
                
                needToAdd -= r.get(charFreq[beginning - 'a']);
                needToAdd += r.get(charFreq[beginning - 'a'] - 1);
                --charFreq[beginning - 'a'];
            }
        }
        
        return answer.toString();
    }

    public static SampleHandler of(SampleReader sr) {
        String answer = "-1";
        if (sr.n % sr.k == 0) {
            answer = getExistingAnswer(sr);
        }
        
        return new SampleHandler(answer);
    }
    
    public void outputResult(PrintWriter out) {
        out.printf(answer + "\n");
    }
}