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 static java.lang.Math.max;
import static java.lang.Math.min;
import static java.lang.Math.abs;
import java.io.*;
import java.util.*;

public class A
{
    static int n, k;
    static int[] arr;
    static char[] s;
    public static void main(String[] args) throws IOException
    {
        f = new Flash();
        out = new PrintWriter(System.out);
        
        int T = ni();
        for(int tc = 1; tc <= T; tc++){
            n = ni(); k = ni(); s = nc(); sop(fn());
        }
        
        out.flush(); out.close();
    }
    
    static String fn()
    {
    	if(n%k != 0) return "-1";
        int[][] cnt = new int[n][26];
        for(int i = 0; i < n; i++) {
        	cnt[i][s[i]-'a']++;
        	if(i > 0) {
        		for(int j = 0; j < 26; j++) {
        			cnt[i][j] += cnt[i-1][j];
        		}
        	}
        }
        
        if(check(cnt)) return new String(s);
        
        for(int i = n-1; i >= 1; i--) {
        	for(int j = (s[i-1]-'a')+1; j < 26; j++) {
        		cnt[i-1][s[i-1]-'a'] -= 1;
        		cnt[i-1][j] += 1;
            	
            	int sum = 0;
            	int[] need = new int[26];
            	for(int c = 0; c < 26; c++) {
            		if(cnt[i-1][c] == 0 || cnt[i-1][c] % k == 0) continue;
            		int req = k-(cnt[i-1][c] % k);
            		need[c] = req;
            		sum += req;
            	}
            	
            	//sop(Arrays.toString(need));
            	cnt[i-1][s[i-1]-'a'] += 1;
            	cnt[i-1][j] -= 1;
            	
            	if(sum > (n-i)) continue;
            	if(((n-i)-sum) % k != 0) continue;
            	
            	int idx = i;
            	for(int t = 1; t <= (n-i)-sum; t++) s[idx++] = 'a';
            	for(int c = 0; c < 26; c++) {
            		for(int t = 1; t <= need[c]; t++) {
            			s[idx++] = (char)('a'+c);
            		}
            	}
            	
            	s[i-1] = (char)('a'+j);
            	return new String(s);
        	}
        }
        
        return new String(s);
    }
    
    static boolean check(int[][] cnt) {
    	boolean ok = true;
        for(int i = 0; i < 26; i++) {
        	ok &= (cnt[n-1][i]%k == 0);
        }if(ok) return true;
        
        for(int i = (s[n-1]-'a')+1; i < 26; i++) {
        	cnt[n-1][s[n-1]-'a'] -= 1;
        	cnt[n-1][i] += 1;
        	
        	ok = true;
            for(int c = 0; c < 26; c++) {
            	ok &= (cnt[n-1][c]%k == 0);
            }
            
            if(ok) {
            	s[n-1] = (char)('a'+i);
            	return true;
            }
        	
        	cnt[n-1][s[n-1]-'a'] += 1;
        	cnt[n-1][i] -= 1;
        }
        
        return false;
    }
    
    static Flash f;
    static PrintWriter out;
    static final long mod = (long)1e9+7;
    static final long inf = Long.MAX_VALUE;
    static final int _inf = Integer.MAX_VALUE;
    static final int maxN = (int)5e5+5;
    static long[] fact, inv;
    
    static void sort(int[] a){
        List<Integer> A = new ArrayList<>();
        for(int i : a) A.add(i);
        Collections.sort(A);
        for(int i = 0; i < A.size(); i++) a[i] = A.get(i);
    }
    
    static void sort(long[] a){
        List<Long> A = new ArrayList<>();
        for(long i : a) A.add(i);
        Collections.sort(A);
        for(int i = 0; i < A.size(); i++) a[i] = A.get(i);
    }
    
    static void print(int[] a){
        StringBuilder sb = new StringBuilder();
        for(int i = 0; i < a.length; i++) sb.append(a[i] + " ");
        sop(sb);
    }
    
    static void print(long[] a){
        StringBuilder sb = new StringBuilder();
        for(int i = 0; i < a.length; i++) sb.append(a[i] + " ");
        sop(sb);
    }
    
    static int swap(int itself, int dummy){return itself;}
    static long swap(long itself, long dummy){return itself;}
    static void sop(Object o){out.println(o);}
    static int ni(){return f.ni();}
    static long nl(){return f.nl();}
    static double nd(){return f.nd();}
    static String next(){return f.next();}
    static String ns(){return f.ns();}
    static char[] nc(){return f.nc();}
    static int[] arr(int len){return f.arr(len);}
    static int gcd(int a, int b){if(b == 0) return a; return gcd(b, a%b);}
    static long gcd(long a, long b){if(b == 0) return a; return gcd(b, a%b);}
    static int lcm(int a, int b){return (a*b)/gcd(a, b);}
    static long lcm(long a, long b){return (a*b)/gcd(a, b);}
    
    static class Flash
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");
        
        String next(){
            while(!st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch(IOException e){
                    e.printStackTrace();
                }
            }
            
            return st.nextToken();
        }
        
        String ns(){
            String s = new String();
            try{
                s = br.readLine().trim();
            }catch(IOException e){
                e.printStackTrace();
            }
            
            return s;
        }
        
        int[] arr(int n){
            int[] a = new int[n];
            for(int i = 0; i < n; i++) a[i] = ni();
            return a;
        }
        
        char[] nc(){return ns().toCharArray();}
        int ni(){return Integer.parseInt(next());}
        long nl(){return Long.parseLong(next());}
        double nd(){return Double.parseDouble(next());}
    }
}