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 ll long long int
#define pb push_back
#define mp make_pair
#define ff(i,n) for(i=0;i<n;++i)
#define yes cout<<"Yes"<<endl;
#define no  cout<<"No"<<endl;
#define F first
#define S second
void solve(){
	ll i,j,p,n,k;
	scanf("%lld %lld",&n,&k);
	string s;
	cin>>s;
	if(n%k!=0){
		printf("-1\n");
		return ;
	}
	ll dp[n][26];
	ff(i,n){
		ff(j,26){
			dp[i][j] = 0;
		}
	}
	dp[0][s[0]-'a']++;
	for(i=1;i<n;i++){
		for(j=0;j<26;j++){
			if((s[i]-'a')!=j)
				dp[i][j] = dp[i-1][j];
			else
				dp[i][j] = dp[i-1][j] + 1;	
		}
	}
	ll check = 1;
	ff(i,26){
		if(dp[n-1][i]%k!=0)
			check = 0;
	}
	if(check==1){
		cout<<s<<endl;
		return ;
	}
	for(i=n-1;i>=0;i--){
	    ll loss[26]={0},rem=0;
		dp[i][s[i]-'a']--;
		for(j=0;j<26;j++){
			loss[j]=(k-dp[i][j]%k)%k;
			rem+=loss[j];	
		}
		for(char c=1+s[i];c<='z';c++){
			j = c-'a';
			rem-=loss[j];
			loss[j] = (loss[j]-1+k)%k;
			rem += loss[j];
			if(((n-1-i)>=rem) && ((n-1-i-rem)%k==0)){
				s[i] = c;
				string temp;
				for(j=0;j<26;j++){
					char kam = j+'a';
					if(loss[j]!=0){
						for(p=0;p<loss[j];p++){
							temp.pb(kam);
						}
					}
				}
				while(temp.size()!=(n-1-i)){
					temp.pb('a');
				}
				sort(temp.begin(),temp.end());
				for(j=0;j<i;j++)
					printf("%c",s[j]);
				cout<<c<<temp<<endl;
				return ;
			}
			rem-=loss[j];
			loss[j]=(loss[j]+1)%k;
			rem+=loss[j];
		}
	}
}
int main(){
	ll t;
	cin>>t;
	while(t--){
		solve();
	}	
}