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
	if n%k:print(-1);continue
	for i in range(n):
		v[s[i]]+=1
		if v[s[i]]%k==1:
			val+=k
		if val>n:
			#print(chr(s[i]+97),val)
			flg=False
			for j in range(i,-1,-1):
				v[s[j]]-=1
				if v[s[j]]%k==0:
					val-=k
				#print(val)
				for c in range(s[j]+1,26):
					if val+(k if (v[c]+1)%k==1 else 0)<=n:
						s[j]=c
						v[c]+=1
						s=s[:j+1]
						flg=True
						break
				if flg:break
			break
	prt=[]
	for i in range(26):
		if v[i]%k:prt.extend([i]*(k-v[i]%k))
	print(*[chr(i+97) for i in s+[0]*(n-len(s)-len(prt))+prt],sep='')