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

def possible(s,index,letters,k,ans):
    req = sum(letters)
    give = len(s)-index
    if req > give:
        return False

    if (give-req)%k != 0:
        return False

    while len(s) != index:
        s.pop()

    for i in range(give-req):
        s.append('a')

    for i in range(26):
        for j in range(letters[i]):
            s.append(chr(ord('a')+i))

    ans.append(''.join(s))

    return True

def solve(n,k,s,ans):
    letters = [0]*26
    for i in s:
        letters[ord(i)-ord('a')] += 1

    for i in range(26):
        letters[i] %= k

    if letters.count(0) == 26:
        ans.append(s)
        return

    if n%k != 0:
        ans.append('-1')
        return

    s = list(s)
    for i in range(len(s)-1,-1,-1):
        letters[ord(s[i])-ord('a')] -= 1
        letters[ord(s[i])-ord('a')] %= k
        prev = s[i]
        for j in range(ord(s[i])-ord('a')+1,26):
            s[i] = chr(ord('a')+j)
            letters[j] += 1
            letters[j] %= k
            if possible(s,i+1,letters,k,ans):
                return

            s[i] = prev
            letters[j] -= 1
            letters[j] %= k
            

def main():
    t = int(input())
    ans = []
    for i in range(t):
        n,k = map(int,input().split())
        s = input()
        solve(n,k,s,ans)

    print('\n'.join(ans))

main()
