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

zz=1
 
sys.setrecursionlimit(10**5)
if zz:
	input=sys.stdin.readline
else:	
	sys.stdin=open('input.txt', 'r')
	sys.stdout=open('all.txt','w')
di=[[-1,0],[1,0],[0,1],[0,-1]]

def fori(n):
	return [fi() for i in range(n)]	
def inc(d,c,x=1):
	d[c]=d[c]+x if c in d else x
def ii():
	return input().rstrip()	
def li():
	return [int(xx) for xx in input().split()]
def fli():
	return [float(x) for x in input().split()]	
def dadd(d,p,val):
	if p in d:
		d[p].append(val)
	else:
		d[p]=[val]		
def gi():	
	return [xx for xx in input().split()]
def gtc(tc,ans):
	print("Case #"+str(tc)+":",ans)	
def cil(n,m):
	return n//m+int(n%m>0)	
def fi():
	return int(input())
def pro(a): 
	return reduce(lambda a,b:a*b,a)		
def swap(a,i,j): 
	a[i],a[j]=a[j],a[i]	
def prec(a,pre):
	for i in a:
		pre.append(pre[-1]+i)
	pre.pop(0)	
def YN(flag):
	print("YES" if flag else "NO")	
def si():
	return list(input().rstrip())	
def mi():
	return 	map(int,input().split())			
def gh():
	sys.stdout.flush()
def isvalid(i,j,n,m):
	return 0<=i<n and 0<=j<m 
def bo(i):
	return ord(i)-ord('a')	
def graph(n,m):
	for i in range(m):
		x,y=mi()
		a[x].append(y)
		a[y].append(x)


t=fi()
INF=10**18
uu=t


while t>0:
	t-=1
	n,k=mi()
	
	s=ii()
	d={}
	c=0
	if n%k:
		print(-1)
		continue
	if s[0]=='z':
		ans="z"*n
	else:
		ans=chr(ord(s[0])+1)*n	
	for i in range(26):
		d[chr(ord('a')+i)]=0
	r=-1		
	w={}
	for i in range(n-1):
		c-=(k-d[s[i]])%k
		inc(d,s[i])
		d[s[i]]%=k
		c+=(k-d[s[i]])%k
		vis={}
		for j in d:
			vis[j]=d[j]
		for j in range(26):
			rr=c
			if bo(s[i+1])>=j:
				continue
			z=vis[chr(j+ord('a'))]	
			rr-=(k-z)%k
			vis[chr(j+ord('a'))]+=1
			vis[chr(j+ord('a'))]%=k
			rr+=(k-vis[chr(j+ord('a'))])%k
			if n-i-1>=rr:
				r=i
				w[i+1]=j
				break			
	c-=(k-d[s[-1]])%k			
	inc(d,s[-1])
	d[s[-1]]%=k
	c+=(k-d[s[-1]])%k

	if c==0:
		print(s)
		continue
	if r==-1:
		print(ans)
		continue	
	d={}
	for i in range(26):
		d[chr(ord('a')+i)]=0

	s=s[:r+1]
	s+=chr(w[r+1]+ord('a'))	
	for i in range(r+2):
		inc(d,s[i])
		d[s[i]]%=k
	p=[]
	#print(r,chr(w[r+1]+ord('a')))
	for i in d:
		for j in range((k-d[i])%k):
			p.append(i)	
	for i in range(r+2+len(p),n):
		p.append('a')
	p.sort()
	s=s[:r+2]
	for i in p:
		s+=i
	print(s)		
