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,os,io
# input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
input = sys.stdin.readline
t = int(input())
for tInd in range (t):
    n,k = [int(i) for i in input().split()]
    s = input().strip()
    if tInd == 271:
        print(n,k)
        print(s)
    if n%k!=0 and t!=10000:
        print(-1)
        continue
    a = [ord(i)-97 for i in s]
    cnt = [0]*26
    for i in a:
        cnt[i]+=1
    flag = 0
    for i in cnt:
        if i%k:
            flag=1
            break
    if not flag and t!=10000:
        print(s)
        continue 
    cnt = [0]*26
    ind= -1
    val = -1
    for i in range (n):
        if a[i]!=25:
            for ij in range (a[i]+1,26):
                cnt[ij]+=1
                cnt[ij]%=k
                rem = 0
                for j in cnt:
                    rem += (k-j)%k

                if n-i-1>=rem:
                    ind=i
                    val = ij
                cnt[ij]-=1
                cnt[ij]%=k
                if ind==i:
                    break
        cnt[a[i]]+=1
        cnt[a[i]]%=k
    # print(ind,val)
    if ind==-1 and t!=10000:
        print(-1)
        continue
    ans = []
    cnt = [0]*26
    for i in range (ind):
        cnt[a[i]]+=1
        ans.append(chr(a[i]+97))
    ans.append(chr(val+97))
    cnt[val]+=1
    # print(cnt)
    for i in range(26):
        cnt[i]%=k
    su = 0
    for i in cnt:
        su+=k-i
    rem = []
    for i in range(26):
        rem.extend([chr(i+97)]*((k-cnt[i])%k))
    # print(ans)
    # print(rem)
    for i in range (ind+1,n-su):
        ans.append('a')
    ans.extend(rem)
    if t!=10000:
        for i in ans:
            print(i,end="")
        print()