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

#include <bits/stdc++.h>
#define N 100010
#define ll long long
#define ull unsigned long long
#define mo (ll)((ll)1e9+7)
#define squ(x) ((x)*(x))
#define db double
#define all(x) x.begin(),x.end()
#define cmax(a,b) a=max(a,b)
#define cmin(a,b) a=min(a,b)
#define rep(i,l,r) for(register int i=l;i<=r;++i)
#define drep(i,r,l)for(register int i=r;i>=l;--i)
#define pb push_back
#define inline inline __attribute__((always_inline))
using namespace std;

inline ll read() {
	ll x = 0, f = 1; char ch = getchar();
	while (ch < '0' || ch > '9') {if (ch == '-')f = -1; ch = getchar();}
	while (ch >= '0' && ch <= '9') {x = x * 10 + ch - '0'; ch = getchar();}
	return x * f;
}
char s[N];
int n, k, a[26];
int pd() {
	int res = 0;
	rep(i, 0, 25) {
		if (a[i] % k == 0)continue;
		res += k - (a[i] % k);
	}
	return res;
}
int main() {
	int t = read();
	while (t--) {
		n = read(), k = read();
		scanf("%s", s + 1);
		if (n % k != 0) {puts("-1"); continue;}
		memset(a, 0, sizeof(a));
		rep(i, 1, n)++a[s[i] - 'a'];
		if (pd() == 0) {printf("%s\n", s + 1); continue;}
		bool flag = 0;
		//n->1
		drep(i, n, 1) {
			if (flag)break;
			char tmp = s[i];
			while (s[i] < 'z') {
				--a[s[i] - 'a'];
				++s[i];
				++a[s[i] - 'a'];
				int tmp = pd();
				if ((n - i) >= tmp && ((n - i - tmp) % k) == 0) {
					rep(j, 1, i)printf("%c", s[j]);
					int cnt = n - i - tmp;
					rep(i, 1, cnt)printf("a");
					rep(j, 0, 25) {
						int x = k - (a[j] % k);
						if (x == k)continue;
						while (x--)printf("%c", 'a' + j);
					}
					puts("");
					flag = 1; break;
				}
			}
			if (flag)break;
			--a[s[i] - 'a'];
			s[i] = tmp;
		}
		if (!flag)puts("-1");
	}
	return 0;
}