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
for _ in range(int(input())):
    n,k = map(int,input().split())
    d = defaultdict(int)
    s = input()
    last = -1
    neededForPerfection = 0
    for i in range(n):
        if(s[i] != "z"):
            ekUparKa = d[chr(ord(s[i]) + 1)] + 1
            # Fetch the content for read only
            extra = 0
            if(ekUparKa % k != 0):
                extra = k - (ekUparKa % k)
            else:
                extra = -1
            fakeNeededforPerfection = neededForPerfection + extra

            space = n - i - 1 - fakeNeededforPerfection
            # if(i == n-1):
            #     print("SPecial")
            #     print("needed", neededForPerfection)
            #     print("Extra", extra)
            #     print(fakeNeededforPerfection)
            #     print(space)
            if(space >= 0 and space % k == 0):
                last = i
            # Update real content
            # First remove already added
            extra = 0
            ekUparKa = d[s[i]]
            if(ekUparKa % k != 0):
                extra = k - (ekUparKa % k)
            neededForPerfection -= extra
            # Update 
            d[s[i]]+=1
            # Add again real content
            extra = 0
            ekUparKa = d[s[i]]
            if(ekUparKa % k != 0):
                extra = k - (ekUparKa % k)
            neededForPerfection += extra
    ok = True
    for key in d:
        if(d[key] % k != 0):
            ok = False
            break
    if(ok):
        print(s)
    else:
        if(last == -1):
            print(-1)
        elif(last == n - 1):
            print(s[:last] + chr(ord(s[-1]) + 1))
        else:
            ans = s[:last]
            ans += chr(ord(s[last])+ 1)
            dc = defaultdict(int)
            for i in ans:
                dc[i] += 1
            adding = []
            for key in dc.keys():
                count = dc[key]
                extra = 0
                if(count % k != 0):
                    extra = k - (count % k)
                adding.extend([key for i in range(extra)])
            pp = len(adding)
            for i in range(n - len(ans) - pp):
                adding.append('a')
            adding.sort()
            for i in adding:
                ans += i
            print(ans)                