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 C {
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            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 FastReader s = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);

    private static int[] rai(int n) {
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = s.nextInt();
        }
        return arr;
    }

    private static int[][] rai(int n, int m) {
        int[][] arr = new int[n][m];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                arr[i][j] = s.nextInt();
            }
        }
        return arr;
    }

    private static long[] ral(int n) {
        long[] arr = new long[n];
        for (int i = 0; i < n; i++) {
            arr[i] = s.nextLong();
        }
        return arr;
    }

    private static long[][] ral(int n, int m) {
        long[][] arr = new long[n][m];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                arr[i][j] = s.nextLong();
            }
        }
        return arr;
    }

    private static int ri() {
        return s.nextInt();
    }

    private static long rl() {
        return s.nextLong();
    }

    private static String rs() {
        return s.next();
    }

    static long gcd(long a,long b)
    {
        if(b==0)
        {
            return a;
        }
        return gcd(b,a%b);
    }

    static boolean isPrime(int n) {
        //check if n is a multiple of 2
        if (n % 2 == 0) return false;
        //if not, then just check the odds
        for (int i = 3; i <= Math.sqrt(n); i += 2) {
            if (n % i == 0)
                return false;
        }
        return true;
    }
    static int MOD=1000000007;

    static long mpow(long base,long pow)
    {
        long res=1;
        while(pow>0)
        {
            if(pow%2==1)
            {
                res=(res*base)%MOD;
            }
            pow>>=1;
            base=(base*base)%MOD;
        }
        return res;
    }

    static public int minimumSize(int[] nums, int m) {
        PriorityQueue<Integer> pq=new PriorityQueue<>(Collections.reverseOrder());
        for(int i:nums)
        {
            pq.add(i);
        }
        System.out.println(pq);
        for(int i=0;i<m;i++)
        {
            int val=pq.remove();

            if(val==1)
            {
                return 1;
            }
            int f=val/2;
            int s=val-f;
            pq.add(f);
            pq.add(s);
            System.out.println(pq);
        }
        return pq.remove();
    }

    static int bsearch(List<Integer> list, int ind)
    {
        int l=0,r=list.size()-1;
        while(l<=r)
        {
            int mid=(l+r)/2;
            if(list.get(mid)>ind)
            {
                if(mid==0 || list.get(mid-1)<=ind)
                    return list.get(mid);
                else
                {
                    r=mid-1;
                }

            }
            else {
                l=mid+1;
            }
        }
        return -1;
    }
    static boolean isValid(int[] count,int k)
    {
        for(int i:count)
        {
            if(i%k!=0)
            {
                return false;
            }
        }
        return true;
    }
    public static void main(String[] args) {
        StringBuilder ans = new StringBuilder();
        int t = ri();
//        int t = 1;
        while (t-- > 0)
        {
            int n=ri();
            int k=ri();
            char[] arr=rs().toCharArray();

            if(n%k!=0)
            {
                ans.append("-1\n");
                continue;
            }

            int[][] count = new int[n][26];
            for(int i=0;i<n;i++)
            {
                if(i>0)
                {
                    for(int j=0;j<26;j++)
                    {
                        count[i][j]=count[i-1][j];
                    }
                }
                count[i][arr[i]-'a']++;

            }
            if(isValid(count[n-1],k))
            {
                for(char c:arr)
                {
                    ans.append(c);
                }
                ans.append("\n");
                continue;
            }


            boolean flag = false;
            for(int i=n-1;i>=0;i--)
            {
//                System.out.println(i);
                for(char ch = (char)(arr[i]+1); ch<='z';ch++)
                {
                    int[] curr = count[i];
                    curr[arr[i]-'a']--;
                    curr[ch-'a']++;
//                    System.out.println("\tcurr= "+Arrays.toString(curr));
                    int[] req = new int[26];
                    int tot = 0;
                    for (int j = 0; j < 26; j++) {
                        if (curr[j] % k != 0) {
                            req[j] = k - (curr[j] % k);
                            tot += req[j];
                        }

                    }
//                    System.out.println("\treq = "+Arrays.toString(req));

                    int posLeft = n-1-i;
//                    System.out.println("\tposLeft= "+posLeft);
//                    System.out.println("\ttot= "+tot);

                    if(posLeft<tot)
                    {
                        curr[arr[i]-'a']++;
                        curr[ch-'a']--;
                        continue;
                    }

                    flag=true;
                    arr[i] = ch;
                    int ind = i+1;
                    while(tot<posLeft)
                    {
                        arr[ind]='a';
                        posLeft--;
                        ind++;
                    }
//                    System.out.println("\tind= "+ind);
                    for(int j=0;j<26;j++)
                    {
                        while(req[j]>0) {
                            char c = (char) (j + 'a');
                            arr[ind++]=c;
                            req[j]--;
                        }
                    }

                    break;


                }
                if(flag)
                {
                    break;
                }

            }

            for(char c:arr)
            {
                ans.append(c);
            }
            ans.append("\n");

        }
        out.print(ans.toString());
        out.flush();
    }
}