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 int ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef set<int> si;
typedef map<string,int> msi;
typedef map<int,int> mii;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define FOR(i,a,b) for(ll i=int(a);i<ll(b);i++)
#define TR(it,a) for(auto it=a.begin();it!=a.end();it++)
#define REV(i,a,b) for(int i=a;i>=b;i--)
#define debug(x) cout<< #x <<" = "<<x<<"\n"
#define debug2(x,y) cout<< #x <<" = "<<x<<" , "<< #y <<" = "<<y<<"\n"
#define all(x) x.begin(),x.end()
#define sortall(x) (sort(all(x)))
#define FAST_IO ios_base::sync_with_stdio(false);cin.tie(NULL);

ll mpow(ll x,ll y);

const int MOD=1e9+7,MAX=2e5+5;
const ll INF=1e16;

int pref[MAX][26],cctr[26];
void solve()
{
	int n,k; string s;
	cin>>n>>k>>s;
	if(n%k!=0){
		cout<<"-1\n";
		return;
	}
	FOR(i,0,26)
	pref[0][i]=0;
	FOR(i,0,n){
		FOR(j,0,26)
		pref[i+1][j]=pref[i][j];
		pref[i+1][s[i]-'a']++;
	}
	bool done=1;
	FOR(i,0,26){
		if(pref[n][i]%k!=0){
			done=0;
			break;
		}
	}
	if(done){
		cout<<s<<"\n";
		return;
	}
	int upg=-1,which=-1;
	REV(i,n-1,0){
		if(s[i]=='z')
			continue;
		FOR(j,(s[i]-'a')+1,26){
			int count=0;
			REV(l,25,1){
				if(l==j)
					count+=((pref[i][l]+1)%k==0)?0:k-(pref[i][l]+1)%k;
				else
					count+=((pref[i][l])%k==0)?0:k-(pref[i][l])%k;
			}
			if(count<=n-i-1){
				upg=i;
				which=j;
				string ans=s;
				ans[upg]='a'+which;
				pref[upg][which]++;
				FOR(i,upg+1,n)
				ans[i]='a';
				int j=25;
				REV(i,n-1,upg+1){
					if(j==0)
						break;
					if(pref[upg][j]%k==0){
						j--;
						i++;
						continue;
					}
					ans[i]='a'+j;
					pref[upg][j]++;
				}
				cout<<ans<<"\n";
				return;
			}
		}
	}
	
}

int main()
{
	FAST_IO;
	int t=1,i=0;
	cin>>t;
	while(t--){
		//cout<<"Case #"<<++i<<": ";
		solve();
	}
}

ll mpow(ll x, ll y)
{
	if(y==0)
		return 1;
	if(y%2)
		return (x*mpow(x,y-1))%MOD;
	ll ans=mpow(x,y/2);
	ans=(ans*ans)%MOD;
	return ans;
}