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>
using namespace std;
#define N 200100
#define K 8000
string ss[K];
int t,n,k,num[200],nn[K],kk[K];
char s[N];
bool judge(int pos,int op)
{
	int sum = n - pos,cnt = n;
	for(int i = 'z';i >= 'a';--i) {
		int need = (num[i] + k - 1) / k * k - num[i];
		if(sum < need) return false;
		else sum -= need;
		if(op == 1)	while(need--) s[cnt--] = i;
	}
	while(pos < cnt) s[cnt--] = 'a';
	return true;
}
void work()
{
	memset(num,0,sizeof(num));
	for(int i = 1;i <= n;++i) num[s[i]]++;
	if(judge(n,0) == true) return;
	
	for(int i = n;i >= 1;--i) {
		num[s[i]]--;
		while(s[i] < 'z') {
			s[i]++;
			num[s[i]]++;
			if(judge(i,0) == true) {
				judge(i,1);
				return;
			}
			num[s[i]]--;
		}
	}
}
int main()
{
   	cin>>t;
   	while(t--) {
	   	cin>>n>>k>>s + 1;
	  	if(n % k != 0) cout<<-1<<endl;
		else work(),cout<<s + 1<<endl;
	}
	
    return 0;
}