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;
typedef long long ll;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f;
const double pi=3.1415926535897932384626;
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<<1)+(x<<3)+(ch^48);
		ch=getchar();
	}
	return x*f;
}
const int maxn=1e5+5;
int t,n,k,vis[30];
char s[maxn];
int calc(int x){
	return (k-x%k)%k;
}
int main(){
	t=read();
	while(t--){
		for(int i=0;i<=25;++i) vis[i]=0;
		n=read(),k=read();
		scanf("%s",s);
		for(int i=0;i<n;++i) ++vis[s[i]-'a'];
		int sum=0,flag=1;
		for(int i=0;i<=25;++i) sum+=calc(vis[i]);
		if(sum==0) printf("%s\n",s);
		else if(n%k) printf("-1\n");
		else{
			for(int i=n-1;i>=0;--i){
				sum=sum-calc(vis[s[i]-'a'])+calc(--vis[s[i]-'a']);
				for(int j=s[i]-'a'+1;j<=25;++j){
					int now=sum;
					sum=sum-calc(vis[j])+calc(++vis[j]);
					if(i+1+sum<=n){
						for(int p=0;p<i;++p) printf("%c",s[p]);
						printf("%c",'a'+j);
						for(int p=1;p<=n-sum-(i+1);++p) printf("a");
						for(int p=0;p<=25;++p){
							int x=calc(vis[p]);
							while(x--) printf("%c",'a'+p);
						}
						printf("\n");
						flag=0;
						break;
					}
					--vis[j];
					sum=now;
				}
				if(!flag) break;
			}
		}
	}
	return 0;
}
