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

def index(i):
    return ord(i)-ord('a')

def get(x,k):
    return (k-(x%k))%k

t = int(input())
for _ in range(t):
    n,k = map(int,input().split())
    s = input()
    if s[-1]=='\n':
        s = s[:-1]
    count = [0]*26
    for i in s:
        count[index(i)] += 1
    
    su,flag = 0,1
    
    for i in range(26):
        su += get(count[i],k)
    
    ans = ''
    
    if su==0:
        ans += s
        flag = 0
    
    if n%k!=0:
        ans = -1
        flag = 0
    
    for i in range(n-1,-1,-1):
        if not flag:
            break
        su -= get(count[index(s[i])],k)
        count[index(s[i])] -= 1
        su += get(count[index(s[i])],k)
        
        for j in range(index(s[i])+1,26):
            temp = su
            su -= get(count[j],k)
            count[j] += 1
            su += get(count[j],k)
            
            if i+su<n:
                ans += s[:i] + chr(ord('a')+j)
                add = ''
                for w in range(26):
                    f = get(count[w],k)
                    while f:
                        f -= 1
                        add += chr(ord('a')+w)
                
                while(len(add)+i+1<n):
                    add += 'a'
                
                add = ''.join(sorted(add))
                ans += add
                flag = 0
                break
            count[j] -= 1
            su = temp
    
    print(ans)