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 math
from collections import defaultdict, Counter
from functools import lru_cache

t = int(input())
for _ in range(t):
    n, k = [int(i) for i in input().split()]
    alpha = [chr(x) for x in range(ord('a'), ord('z') + 1)]
    s = input()
    if n % k != 0:
        print(-1)
    else:
        count = Counter(s)
        flag = 0
        ans = 'z' * n
        avail = 0
        for i in range(n-1, -1, -1):
            count[s[i]] -= 1
            if s[i] == 'z':
                continue
            else:
                for ele in alpha:
                    if ele <= s[i]:
                        continue
                    count[ele] += 1
                    temp = 0
                    avail1 = avail
                    s2 = ele
                    for char in alpha:
                        if count[char] % k != 0:
                            req = (k - (count[char] % k))
                            if req > avail1:
                                temp = 1
                                break
                            else:
                                s2 += (req * char)
                                avail1 -= req
                            if temp == 1:
                                break
                    count[ele] -= 1
                    if temp == 0:
                        flag = 1
                        ans = s[:i] + s2
                        break
                if flag == 1:
                    break
            avail += 1
            #print(count)
        print(ans)








