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 defaultdict
from itertools import accumulate
import sys
input = sys.stdin.readline
'''
for CASES in range(int(input())):
n, m = map(int, input().split())
n = int(input())
A = list(map(int, input().split()))
S = input().strip()
sys.stdout.write(" ".join(map(str,ANS))+"\n")
'''
inf = 100000000000000000  # 1e17
mod = 998244353

def solve():
    n, k = map(int, input().split())
    S = input().strip()
    B=[[0 for i in range(26)] for j in range(n+1)]
    for i in range(len(S)):
        tmp=ord(S[i])-ord('a')
        for ii in range(26):
            if i==0:
                B[i][ii]=0
            else:
                B[i][ii]=B[i-1][ii]
        B[i][tmp]+=1

    oneshot=True
    for i in range(26):
        if B[n-1][i]%k!=0:
            oneshot=False
            break
    if oneshot:
        return S

    # if not remove [0]
    for i in range(len(S)-1,-1,-1):
        for j in range(ord(S[i])+1,ord('z')+1):
            # print(chr(j))
            # sys.exit(0)
            remain=[0]*26
            remain[j-ord('a')]+=1
            for ii in range(26):
                remain[ii]=(remain[ii]+B[i-1][ii])%k
                if remain[ii]==0:
                    remain[ii]==k
            for ii in range(26):
                remain[ii]=(k-remain[ii])%k


            need=sum(remain)
            # if i==1 and j==99:
            #     print(need)
            #     print(remain)
            if not (need<=(n-1-i) and ((n-1-i-need)%k==0)):
                continue
            else:
                ANS=[]
                FORM=[]
                for ii in range(i):
                    FORM.append(S[ii])
                FORM.append(chr(j))


                for ii in range(26):
                    for jj in range(remain[ii]):
                        ANS.append(chr(ii+97))
                for ii in range((n-1-i-need)):
                    ANS.append('a')
                ANS=FORM+sorted(ANS)
                return "".join(ANS)

    # if remove [0]
    if len(S)%k==0:
        ANS=[]
        for i in range(k):
            ANS.append(chr(ord(S[0])+1))
        while len(ANS)!=len(S):
            ANS.append('a')
        return "".join(ANS)


    return '-1'

for CASES in range(int(input())):
    print(solve())



