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

def solve():
	for i in range(int(input())):
		n, k = map(int, input().split());s = input().strip()
		if k == 1:print(s);continue
		if n % k != 0:print(-1);continue
		want = [0]*26;need = 0;i = 0;best = -1;A = ord('a')
		for c in s:
			v = ord(c)-A
			if v < 25:
				for j in range(v+1,26):
					if want[j] == 0:
						if need + k - 1 <= n - i - 1:best = i;break
					else:
						if need - 1 <= n - i - 1:best = i;break
			if want[v] == 0:want[v] = k - 1;need += k - 1
			else:need -= 1;want[v] -= 1
			i += 1
		if need == 0:print(s);continue
		if best == -1:print(-1);continue
		want = [0]*26;need = 0;i = 0
		for c in s:
			v = ord(c)-A
			if i == best:
				res = list(s[:i])
				for j in range(v+1,26):
					if want[j] == 0:
						if need + k - 1 <= n - i - 1:need += k - 1;want[j] = k - 1;res.append(chr(j+A));break
					else:
						if need - 1 <= n - i - 1:res.append(chr(j+A));want[j] -= 1;need -= 1;break
				while need < n - i - 1:want[0] += k;need += k
				for z in range(26):
					for _ in range(want[z]):res.append(chr(z+A))
				print(''.join(res));break
			if want[v] == 0:want[v] = k - 1;need += k - 1
			else:need -= 1;want[v] -= 1
			i += 1
solve()