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

from collections import deque, defaultdict
from math import sqrt, ceil, factorial, floor, inf, log2
import bisect
import sys
import copy
def get_array(): return list(map(int, sys.stdin.readline().strip().split()))
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def input(): return sys.stdin.readline().strip()
stri='abcdefghijklmnopqrstuvwxyz'
for _ in range(int(input())):
    n,l=get_ints()
    s=input()
    arr=[[0 for i in range(26)]for j in range(n)]
    arr[0][ord(s[0])-97]=1
    flag=0
    flag2=0
    for i in range(1,n):
        arr[i][ord(s[i])-97]+=1
        for j in range(26):
            arr[i][j]+=arr[i-1][j]
    flag3=0
    for i in range(26):
        if arr[n-1][i]%l!=0:
            flag3=1
    if flag3==0:
        print(s)
    else:

    ##print(arr)
        for i in range(n):
            ##print(a)
            ##print(d)
            for j in range(ord(s[i])-97+1,26):
                if i == 0:
                    a = [0] * 26
                else:
                    a = arr[i - 1]
                c=stri[j]
                a[j]+=1
                d=[0]*26
                cnt=0
                rems=n-(i+1)
               ## print(a)
                ##if i==1 and j==2:
                   ## print(a)
                for k in range(26):
                    if a[k]%l!=0:
                        req=ceil(a[k]/l)*l
                        addi=req-a[k]
                        d[k]=addi
                        cnt+=addi
                ##if i==1 and j==2:
                   ## print(d)
                if cnt<=rems and (rems-cnt)%l==0:
                    ind=i
                    ele=j
                    d[0]+=rems-cnt
                    flag=1
                    e=copy.deepcopy(d)
                    if i==n-1:
                        flag2=1
                if flag2==1:
                    break
            if flag2==1:
                break


        ##print(ind,ele)
        #3print(d)
        if flag==1:
            st=""
            for i in range(ind):
                st+=s[i]
            st+=stri[ele]
            for i in range(26):
                st+=stri[i]*e[i]

            print(st)
        else:
            print(-1)









