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 class Reader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public Reader() 
        { 
            br = new BufferedReader(new
                     InputStreamReader(System.in)); 
        } 
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    }
	static int get(int n,int k) {
		int res = (k-(n%k))%k;
		return res;
	}
    static void solve(Reader sc) {
    	int n = sc.nextInt();
    	int k =  sc.nextInt();
    	String s = sc.next();
    	int arr[] = new int[26];
    	for(int i=0;i<n;i++) {
    		arr[s.charAt(i)-'a']++;
    	}
    	int sum =0;
    	for(int i=0;i<26;i++) {
    		sum+= get(arr[i],k);
    	}
    	if(sum==0) {
    		System.out.println(s);
    		return;
    	}
    	if(n%k!=0) {
    		System.out.println(-1);
    		return;
    	}
    	for(int i=n-1;i>=0;i--) {
    		
    		sum-=get(arr[s.charAt(i)-'a'],k);
    		arr[s.charAt(i)-'a']--;
    		sum+=get(arr[s.charAt(i)-'a'],k);
    		for(int j=s.charAt(i)+1;j<'z'+1;j++) {
    			int lst_sum = sum;
    			sum-=get(arr[j-'a'],k);
    			arr[j-'a']++;
    			sum+=get(arr[j-'a'],k);
    			if(sum+i+1<=n) {
    			    System.out.print(s.substring(0,i));
    				System.out.print((char)(j));
    				int res= n-(sum+i+1);
    				while(res!=0) {
    					System.out.print('a');
    					res--;
    				}
    				int p=0;
    				while(p<26) {
    					int temp  = get(arr[p],k);
    					while(temp-->0) {
    						System.out.print((char)(p+'a'));
    					}
    					p++;
    				}
    				
    				System.out.println();
    				return;
    			}
    			arr[j-'a']--;
    			sum=lst_sum;
    			
    			
    		}
    	}
    }
	public static void main(String args[]){
		Reader sc =  new Reader();
		int t = sc.nextInt();
		
		while(t-->0) {
			solve(sc);
		}
      }
   }