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 sys import stdin,stdout
from math import gcd,sqrt,factorial,pi,inf
from collections import deque,defaultdict
from bisect import bisect,bisect_left
from itertools import permutations as per
input=stdin.readline
R=lambda:map(int,input().split())
I=lambda:int(input())
S=lambda:input().rstrip('\n')
L=lambda:list(R())
P=lambda x:stdout.write(str(x)+'\n')
nCr=lambda x,y:(f[x]*inv((f[y]*f[x-y])%N))%N
sm=lambda x:(x**2+x)//2
N=10**9+7

for _ in range(I()):
	n,k=R()
	s=[ord(i)-97 for i in S()]
	v=[0]*26
	val=0
	ans=[]
	if n%k:print(-1);continue
	flg=True
	for i in s:
		v[i]+=1
		p=i
		if v[i]%k==1:val+=k
		if val>n:
			v[i]-=1
			val-=k
			for j in range(i,26):
				x=val
				if x+(k if (v[j]+1)%k==1 else 0)<=n:
					#print(j)
					p=j
					v[j]+=1
					ans+=p,
					flg=False
					break
			if flg:
				g=val-(k if (v[ans[-1]]-1)%k==0 else 0)
				for i in range(ans[-1]+1,26):
					if g+(k if (v[i]+1)%k==1 else 0)<=n:
						v[ans[-1]]-=1
						ans[-1]=i
						v[i]+=1
						flg=False
						break
			if flg:
				l=len(ans)
				#print(v)
				for i in range(l-1,-1,-1):
					v[ans[i]]-=1
					if v[ans[i]]%k==0:
						p=ans[i]
						for j in range(i,l):
							if ans[j]==p:
								ans[j]+=1
								#v[p]-=1
								v[p+1]+=1
						break
			break
		ans+=p,
	ans=ans[:sum(v)]
	prt=[]
	for i in range(25,-1,-1):
		if v[i]%k:prt.extend([i]*(k-v[i]%k))
	#print(prt)
	ans=ans+[0]*(n-len(ans)-len(prt))+prt[::-1]
	print(*[chr(i+97) for i in ans],sep='')	