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 Counter

for _ in range(int(input())):
    n, k = map(int, input().split())
    s = input()
    if n % k:
        print(-1)
    elif k == 1:
        print(s)
    else:
        stat = Counter(s)
        if all(v % k == 0 for v in stat.values()):
            print(s)
            continue
        usage = [0] * 26
        last_i = -1
        last_new_ch = 'z'
        suppl = 0
        for i in range(n):
            for j in range(26):
                cand_ch = chr(ord('a') + j)
                if cand_ch > s[i]:
                    if usage[j] % k == 0:
                        new_suppl = suppl +  k - 1
                    else:
                        new_suppl = suppl - 1
                    
                    if new_suppl <= (n - i - 1):
                        last_new_ch = cand_ch
                        last_i = i
                        break


            idx = ord(s[i]) - ord('a')
            if usage[idx] % k == 0:
                suppl += k - 1
            else:
                suppl -= 1
            usage[idx] += 1
            
        if last_i == -1:
            print(last_i)
            continue
        else:
            prefix = s[:last_i] + last_new_ch
            stat = Counter(prefix)
            ans = [prefix]
            suffix = []
            for j in range(26):
                cur = stat.get(chr(ord('a') + j), 0) % k 
                if cur > 0:
                    suffix.append(chr(ord('a') + j) * (k - cur))
            suffix = ''.join(suffix)
            rem = n - len(suffix) - len(prefix)
            print(''.join([prefix, 'a' * rem, suffix]))
            continue
