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 *

def check(extra):
    for i in c:
        req = (k-c[i]%k)%k
        extra-=req
        if extra<0:
            return -1
    rem = []
    for i in c:
        req = k-c[i]%k if c[i]%k else 0
        rem += [i]*req
    return sorted(rem)

for _ in range(int(input())):
    n,k = map(int,input().split())
    s = list(map(ord,input()))
    if n%k:
        print(-1)
        continue
    c = Counter(s)
    if check(0)!=-1:
        s =[chr(i) for i in s]
        print("".join(s))
    else:
        ans=0
        for i in range(n-1,0,-1):
            c[s[i]]-=1
            for j in range(s[i]+1,123):
                c[j]+=1
                if check(n-1-i)!=-1:
                    ans = s[:i]+[j]+check(n-1+i)
                    ans = [chr(i) for i in ans]
                    print("".join(ans))
                    break
                c[j]-=1
            if ans:break