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
import math
from itertools import permutations
from bisect import bisect_left
import heapq
from collections import deque
def II():
	return int(sys.stdin.readline())
 
def LI():
	return list(map(int, sys.stdin.readline().split()))
 
def MI():
	return map(int, sys.stdin.readline().split())
 
def SI():
	return sys.stdin.readline().strip()
 
def FACT(n, mod):
    s = 1
    facts = [1]
    for i in range(1,n+1):
        s*=i
        s%=mod
        facts.append(s)
    return facts[n]
 
def C(n, k, mod):
    return (FACT(n,mod) * pow((FACT(k,mod)*FACT(n-k,mod))%mod,mod-2, mod))%mod
 
def lcm(a,b):
    return abs(a*b) // math.gcd(a, b)
 
for _ in range(II()):
    n,k = MI()
    s = list(SI())
    if n%k != 0:
        print(-1)
    else:
        d = [0 for _ in range(26)]
        for i in range(n):
            d[ord(s[i])-97]+=1
            if d[ord(s[i])-97] == k:
                d[ord(s[i])-97] = 0
        boo = True
        ans = []
        for i in range(26):
            if d[i]%k != 0:
                boo = False
        ans = s
        if not boo:
            ans = []
            for i in range(n-1,-1,-1):
                d[ord(s[i])-97]-=1
                for j in range(ord(s[i])-97+1, 26):
                    d[j]+=1
                    temp = [0 for _ in range(26)]
                    for x in range(26):
                        temp[x] = (-d[x])%k
                    if sum(temp) <= n-i-1:
                        ans = s[:i]
                        ans.append(chr(j+97))
                        ans.append('a'*(n-i-1-sum(temp)))
                        for x in range(26):
                            ans.append(chr(x+97)*temp[x])
                        boo = True
                        break
                    d[j]-=1
                if boo:
                    break
        print(''.join(ans))




