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 os import path;import sys,time
# mod = int(1e9 + 7)
from math import ceil, floor,gcd,log,log2 ,factorial,sqrt
from collections import defaultdict ,Counter , OrderedDict , deque;from itertools import combinations,permutations
# from string import ascii_lowercase ,ascii_uppercase
from bisect import *;from functools import reduce;from operator import mul;maxx = float('inf')
I = lambda :int(sys.stdin.buffer.readline())
lint = lambda :[int(x) for x in sys.stdin.buffer.readline().split()]
S = lambda: sys.stdin.readline().strip('\n')
grid = lambda  r :[lint() for i in range(r)]
localsys = 0
start_time = time.time()
#left shift --- num*(2**k) --(k - shift)
nCr = lambda n, r: reduce(mul, range(n - r + 1, n + 1), 1) // factorial(r)
def ceill(n,x):
    return (n+x -1 )//x
T =True
def ok(s , freq ,i ,n ,k):
	left, A = n - i - 1 , ord('a')
	freq[ord(s[i]) - A] -= 1
	if s[i] =='z':return False
	for c in range(ord(s[i]) + 1 , ord('z') + 1):
		freq[c - A]+=1
		rem = 0
		for j in range(26):
			if freq[j] % k :
				rem+= (k - freq[j]%k)
		if left < rem or (left - rem) % k != 0:
			freq[c - A]-=1
		else:
			arr =[]
			s[i] = chr(c)
			for j in range(26):
				if freq[j] % k :
					arr+= [chr(A + j)]*(k - freq[j]%k)
			if rem < left:
				arr+=['a']*(left- rem)
			arr.sort()
			s[i+1:] = arr
			return True
	return False
def solve():
	n , k = map(int , input().split())
	s = list(input())
	if n% k :
		return print(-1)
	if k == 1:
		return print(''.join(s))
	freq =[0]*26
	for i in s :
		freq[ord(i) - ord('a')]+=1
	f = False
	for i in range(26):
		if freq[i] % k:
			f = True
			break
	if f :
		for i in range(n-1 , -1 , -1):
			if ok(s, freq, i, n,k):
				return print(''.join(s))
	print(''.join(s))







					





    	








def run():
    if (path.exists('input.txt')):
        sys.stdin=open('input.txt','r')
        sys.stdout=open('output.txt','w')


run()
T = I() if T else 1
for _ in range(T):
    solve()


if localsys:
    print("\n\nTime Elased :",time.time() - start_time,"seconds")


