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.*;
import java.util.*;
public class Main {

    public static void main(String[] args) {
        FastScanner in=new FastScanner();
        PrintWriter out=new PrintWriter(System.out);
        int t=in.nextInt();
        while(t-->0)
        solve(in,out);
        out.close();
    }

      static void solve(FastScanner in,PrintWriter out){
        int n=in.nextInt();
        int k=in.nextInt();
        char s[]=in.next().toCharArray();
        char t[]=new char[n];
        int count[]=new int[26];
        int flag=0;
          for (int i = 0; i < n; i++) {
              count[s[i]-'a']++;
          }
          for (int i = n; i >= 0 ; i--) {
              if(i<n) count[s[i]-'a']--;
              int req=0;
              for (int j = 0; j < 26; j++) {
                  req+=(k-((count[j]%k==0)?k:(count[j]%k)));
              }
              //out.println(req+" "+i);
              if(n-i>=req && (n-i-req)%k==0) {
              //out.println(i+" --");
                  if(i==n) {
                      t=(char[])s.clone();
                      flag=1;
                      break;
                  }
                  if(s[i]=='z') continue;
                  //out.println((char)(s[i]+1)+" xx");
                  for(char j=(char)(s[i]+1);j<='z';j++) {
                      if((count[j-'a']%k)!=0) {
                          //out.println(i+" -> "+j);
                          t[i]=j; flag=1; count[j-'a']++; break;
                      }
                  }
                  req=0;
                  for (int j = 0; j < 26; j++) {
                      req+=(k-((count[j]%k==0)?k:(count[j]%k)));
                  }
                  //out.println(req+" req");
                  if(flag==0) {
                      if(n-i-req-1<0 ) continue;
                      flag=1;
                      count[(s[i]+1)-'a']++; t[i]=(char)(s[i]+1);
                  }
                  int p=n-1;
                  for(char j='z';j>='a';j--){
                      int tt=0;
                      if((count[j-'a']%k)!=0) tt=k-(count[j-'a']%k);
                      while(tt-->0) t[p--]=j;
                  }
                  while(p>i){
                      t[p--]='a';
                  }
                  for(int j=0;j<i;j++){
                      t[j]=s[j];
                  }
              }
              if(flag==1) break;
          }
          if(flag==0) out.println(-1);
          else {
              for (int i = 0; i < n; i++) {
                  out.print(t[i]);
              }out.println();
          }

      }



    static class pair<U extends Comparable<U>, V extends Comparable<V>> implements Comparable<pair<U, V>> {
        public U x;
        public V y;

        public pair(U x, V y) {
            this.x = x;
            this.y = y;
        }

        public int compareTo(pair<U, V> other) {
            int i = x.compareTo(other.x);
            if (i != 0) return i;
            return y.compareTo(other.y);
        }

        public String toString() {
            return x.toString() + " " + y.toString();
        }

        public boolean equals(Object obj) {
            if (this.getClass() != obj.getClass()) return false;
            pair<U, V> other = (pair<U, V>) obj;
            return x.equals(other.x) && y.equals(other.y);
        }

        public int hashCode() {
            return 31 * x.hashCode() + y.hashCode();
        }

    }

    static void sort(int[] a) {
        ArrayList<Integer> l=new ArrayList<>();
        for (int i:a) l.add(i);
        Collections.sort(l);
        for (int i=0; i<a.length; i++) a[i]=l.get(i);
    }

    static class FastScanner {
        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();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }
        int[] readArray(int n) {
            int[] a=new int[n];
            for (int i=0; i<n; i++) a[i]=nextInt();
            return a;
        }
        long nextLong() {
            return Long.parseLong(next());
        }
    }
}
