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.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.PriorityQueue;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

@SuppressWarnings("unused")
public class Solution{
	
	static int n, k;
	static char[] s;
	static int[] cnt;
	static ArrayList<int[]> list;
	
	public static void main(String[] args) throws IOException {
    	
		
    	FastScanner fs = new FastScanner();
    	PrintWriter out = new PrintWriter(System.out);
    	
    		
    	int tt = fs.nextInt();
    	outer:
    	while(tt-->0) {
    		
    		n = fs.nextInt();
    		k = fs.nextInt();
    		
    		s = fs.next().toCharArray();
    		
    		if(n%k!=0) {
    			out.println(-1);
    			continue outer;
    		}
    		
    		
    		cnt = new int[26];
    		
    		for(int i=0;i<n;i++) {
    			cnt[s[i]-'a']++;
    		}
    		
    		
    		list = new ArrayList<>();
    		
    		if(check()) {
    			for(int i=0;i<n;i++) out.print(s[i]);
    			out.println();
    			continue outer;
    		}
    		
    		int ind = -2;
    		char c = '\u0000';
    		
    		first:
    		for(int i=n-1;i>=0;i--) {
    			cnt[s[i]-'a']--;
    			for(char ch=(char) (s[i]+1);ch<='z';ch++) {
    				cnt[ch-'a']++;
    				if(check()) {
    					ind = i-1; 
    					c = ch;
    					break first;
    				}
    				cnt[ch-'a']--;
    			}
    		}
    		
    		
    		if(ind==-2) {
    			out.println(-1);
    			continue outer;
    		}
    		
    		StringBuilder str = new StringBuilder("");
    		
    		for(int i=0;i<=ind;i++) {
    			str.append(s[i]);
    		}
    		str.append(c);
    		for(int[] ar: list) {
    			char ch = (char)('a'+ar[0]);
    			int num = ar[1];
    			for(int i=0;i<num;i++) str.append(ch);
    		}
    		
    		out.println(str.toString());
    		
    	}
    	
    	out.close();
    	
    }
	
	
	
	static boolean check() {
		list.clear();
		int[] num = new int[26];
		int left = n;
		for(int i=0;i<26;i++) {
			num[i] += (k-cnt[i]%k)%k;
			left -= (cnt[i]+num[i]);
		}
		if(left<0 || left%k!=0) return false;
		num[0] += left;
		for(int i=0;i<26;i++) {
			if(num[i]>0) list.add(new int[] {i, num[i]});
		}
		return true;
	}
	
	
	
    
    
    static final Random random=new Random();
    
    static <T> void shuffle(T[] arr) {
    	int n = arr.length;
    	for(int i=0;i<n;i++	) {
    		int k = random.nextInt(n);
    		T temp = arr[k]; arr[k] = arr[i]; arr[i] = temp;
    	}
    }
    
    	
    static void ruffleSort(int[] a) {
    	int n=a.length;//shuffle, then sort 
    	for (int i=0; i<n; i++) {
    		int oi=random.nextInt(n); int temp=a[oi];
    		a[oi]=a[i]; a[i]=temp;
    	}
    	Arrays.sort(a);
    }
    
    static void ruffleSort(long[] a) {
    	int n=a.length;//shuffle, then sort 
    	for (int i=0; i<n; i++) {
    		int oi=random.nextInt(n); long temp=a[oi];
    		a[oi]=a[i]; a[i]=temp;
    	}
    	Arrays.sort(a);
    }
   
  
    
    static void reverse(int[] arr, int l, int r) {
    	for(int i=l;i<l+(r-l)/2;i++){
    		int temp = arr[i]; arr[i] = arr[r-i+l-1]; arr[r-i+l-1] = temp;
    	}
    }
    
    static void reverse(long[] arr, int l, int r) {
    	for(int i=l;i<l+(r-l)/2;i++){
    		long temp = arr[i]; arr[i] = arr[r-i+l-1]; arr[r-i+l-1] = temp;
    	}
    }
    
    
    static <T> void reverse(T[] arr, int l, int r) {
    	for(int i=l;i<l+(r-l)/2;i++) {
    		T temp = arr[i]; arr[i] = arr[r-i+l-1]; arr[r-i+l-1] = temp;
    	}
    }
    	
    	
    static class FastScanner{
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	StringTokenizer st = new StringTokenizer("");
     
    	public String next(){
    		while(!st.hasMoreElements()){
    			try{
    				st = new StringTokenizer(br.readLine());
    			} catch(IOException e){
    				e.printStackTrace();
    			}
    		}
    		return st.nextToken();
    	}
    		
    	public String nextLine() throws IOException {
    		return br.readLine();
    	}
    		
    	public int nextInt(){
    		return Integer.parseInt(next());
    	}
     
    	public int[] readArray(int n){
    		int[] a = new int[n];
    		for(int i=0;i<n;i++)
    			a[i] = nextInt();
    		return a;
    	}
    		
    	public long nextLong() {
    		return Long.parseLong(next());
    	}
    		
    	public char nextChar() {
    		return next().toCharArray()[0];
    	}
    }
   	
}
