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 ar array
#define ll long long
#define ld long double

const int mxN=1e5;
int n, k, mp[26];
string s;

int nd(int x) {
	return (k-x%k)%k;
}

void solve() {
	cin >> n >> k >> s;
	cerr << "----- ANSWER -----\n";
	if(n%k) {
		cout << "-1\n";
		cerr << "------------------\n";
		return;}
	memset(mp, 0, 26*4);
	for(int i=0; i<n; ++i)
		++mp[s[i]-'a'];
	int nds=0;
	for(int i=0; i<26; ++i)
		nds+=nd(mp[i]);
	if(!nds) {
		cout << s << "\n";
		cerr << "------------------\n";
		return;}
	for(int i=n-1; ~i; --i) {
		nds-=nd(mp[s[i]-'a']);
		--mp[s[i]-'a'];
		nds+=nd(mp[s[i]-'a']);
		for(int j=s[i]-'a'+1; j<26; ++j) {
			int l=nds;
			nds-=nd(mp[j]);
			++mp[j];
			nds+=nd(mp[j]);
			if(nds+i+1<=n) {
				cerr << "FOUND POSSIBLE AT " << i << ", REP: " << (char)(j+'a') << "\n";
				string ans=(char)(j+'a')+string(n-(nds+1+i), 'a');
				for(int p=0; p<26; ++p)
					ans+=string(nd(mp[p]), p+'a');
				for(int p=0; p<i; ++p)
					cout << s[p];
				cout << ans << "\n";
				cerr << "------------------\n";
				return;
			}
			--mp[j];
			nds=l;
		}
	}
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);

	int t;
	cin >> t;
	while(t--)
		solve();
}
