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 __future__ import print_function # for PyPy2
# from itertools import permutations as perm
# from fractions import Fraction
from collections import *
from sys import stdin
from bisect import *
# from heapq import *
from math import *
 
g   = lambda : stdin.readline().strip()
gl  = lambda : g().split()
gil = lambda : [int(var) for var in gl()]
gfl = lambda : [float(var) for var in gl()]
gcl = lambda : list(g())
gbs = lambda : [int(var) for var in g()]
mod = int(1e9)+7
inf = float("inf")


t, = gil()

def solve(n, k, s):
	if n%k or k == 1: return ''.join(s) if k == 1 else -1

	# solve
	req = {}
	sm = 0
	right = n

	for ch in s:
		# num of chars to the right 
		right -= 1


		# if replaced with new char
		if ch != 'z':
			newCh = chr(ord(ch)+1)
			fi = req.get(newCh, 0)
			newReq = sm + (-1 if fi else k-1)
			if newReq <= right:
				idx = n - right - 1

		# update the req
		fi = req.get(ch, 0)
		sm += (-1 if fi else k-1)
		req[ch] = (fi-1 if fi else k-1)


	if sm == 0:return ''.join(s)

	s[idx] = chr(ord(s[idx])+1)
	req = {}
	sm =0 
	for i in range(idx+1):
		# update the req
		ch = s[i]
		fi = req.get(ch, 0)
		sm += (-1 if fi else k-1)
		req[ch] = (fi-1 if fi else k-1)


	ans = s[:idx+1]
	right = n-1-idx
	extra = right - sm
	req['a'] = req.get('a', 0) + extra
	for ch in 'abcdefghijklmnopqrstuvwxyz':
		fi = req.get(ch)
		if fi:
			ans.append(fi*ch)

	return ''.join(ans)	


for _ in range(t):
	n, k = gil()
	s = gcl()
	print(solve(n, k, s))



