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

input = lambda: sys.stdin.readline().rstrip("\r\n")
s=(0,1,2,5,8)
d={0:0,1:1,2:5,5:2,8:8}
b=[[00,00],[00,1]]
for _ in range(int(input())):
    n,k = map(int, input().split())
    a=input()
    ans=str()
    if len(a)%k:
        print(-1)
    else:
        dp=[0]*26
        t=n-1
        for i in a:
            dp[ord(i)-97] +=1
        tst=1
        for i in dp:
            if i%k:
                tst=0
                break
        if  not tst:
            for i,v in enumerate(reversed(a)):
                dp[ord(v)-97]-=1
                t=n-i-1
                for j in range(ord(v)-97+1,26):
                    rem=i
                    ck=[0]*26
                    ck[j]+=1
                  #  print(dp,ck,i,'a')
                    for id in range(26):
                        if (dp[id]+ck[id])%k:
                            rem-=(k-(dp[id]+ck[id])%k)
                            ck[id]+=k- (dp[id]+ck[id])%k

                  #          print(rem,k,dp[id]+ck[id],(dp[id]+ck[id])%k)
                    if rem>0 and not rem%k:
                        ck[0]+=rem
                        rem=0
                    if rem==0:
                        for id in range(n-i-1):
                            ans+=a[id]
                        ans+=chr(j+97)
                        ck[j]-=1
                        for id,v in enumerate(ck):
                            ans+=chr(id+97)*v
                        break
               #     print(dp,ck,i,rem)
                if ans:
                    break
        else:
            ans=a
        print(ans)
