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 sys
from sys import stdin

tt = int(stdin.readline())
alp = "abcdefghijklmnopqrstuvwxyz"
AAA = []

for loop in range(tt):

    n,k = map(int,stdin.readline().split())
    s = stdin.readline()[:-1]

    if n % k != 0:
        print (-1)
        continue

    oa = ord('a')
    S = [ord(s[i])-oa for i in range(n)]

    l,r = -1,n
    ans = [25] * n

    while r-l != 1:

        mid = (l+r)//2

        clis = [0] * 26
        cnum = 0
        nans = []

        awayflag = False
        ansflag = True
        for i in range(n):
            if i <= mid:
                if clis[i] > 0:
                    nans.append(S[i])
                    clis[i] -= 1
                elif cnum < n:
                    cnum += k
                    nans.append(S[i])
                    clis[S[i]] += k-1
                else:
                    ansflag = False
                    break
            
            elif awayflag == False: #want away

                if S[i] == 25:
                    if clis[25] == 0:
                        ansflag = False
                        break
                    else:
                        clis[25] -= 1
                        nans.append(S[i])
                
                elif clis[S[i]+1] > 0:
                    clis[S[i]+1] -= 1
                    nans.append(S[i]+1)
                    awayflag = True

                elif cnum < n:
                    clis[S[i]+1] += k-1
                    cnum += k
                    nans.append(S[i]+1)
                    awayflag = True

                else: #search
                    for nex in range(S[i]+1,26):
                        if clis[nex] > 0:
                            nans.append(nex)
                            clis[nex] -= 1
                            awayflag = True
                            break
                    else:
                        ansflag = False
                        break
            
            else: #away

                while cnum < n:
                    clis[0] += k
                    cnum += k

                for nex in range(26):
                    if clis[nex] > 0:
                        nans.append(nex)
                        clis[nex] -= 1
                        break
    
        if not ansflag:
            r = mid
        else:
            l = mid
            ans = min(ans,nans)

    
    ANS = [alp[i] for i in ans]
    print ("".join(ANS))
    #print (l,r,file=sys.stderr)