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 sys
input = sys.stdin.readline
from collections import *

alpha = 'abcdefghijklmnopqrstuvwxyz'

for _ in range(int(input())):
    n, k = map(int, input().split())
    s = input()[:-1]
    
    if n%k!=0:
        print(-1)
        continue
    
    cnt = Counter(list(s))
    flag = True
    
    for v in cnt.values():
        if v%k!=0:
            flag = False
    
    if flag:
        print(s)
        continue

    for i in range(n-1, -1, -1):
        cnt[s[i]] -= 1
        need = [0]*26
        
        for c in cnt:
            if cnt[c]%k==0:
                need[ord(c)-ord('a')] = 0
            else:
                need[ord(c)-ord('a')] = k-cnt[c]%k
        
        total = sum(need)
        
        for j in range(ord(s[i])-ord('a')+1, 26):
            total_need = total-need[j]+(need[j]-1)%k
            
            if total_need<=n-1-i and (n-1-i-total_need)%k==0:
                ans = list(s[:i])
                ans.append(alpha[j])
                ans += ['a']*(n-1-i-total_need)
                
                for l in range(26):
                    if l==j:
                        ans += [alpha[l]]*((need[l]-1)%k)
                    else:
                        ans += [alpha[l]]*need[l]
            
                print(''.join(ans))
                break
        else:
            continue
        break