#include <bits/stdc++.h>
 
#define ld long double
#define ar array
#define int long long
std::mt19937 rnd(237);
 
using namespace std;
using ll=long long;
const int mxn=100005;
const ll INF=4e18;

int n, k;
string s;

void solve() {
	cin >> n >> k >> s;
	if (n%k) {
		cout << -1;
		return;
	}
	vector<int> cnt(26,0);
	for (int i=0; i<n; ++i) {
		cnt[s[i]-'a']=(cnt[s[i]-'a']+1)%k;
	}
	bool ok=1;
	for (int i=0; i<26; ++i) {
		if (cnt[i]) ok=0;
	}
	if (ok) {
		cout << s;
		return;
	}
	vector<int> need(26,0);
	int sum=0;
	for (int i=0; i<26; ++i) {
		need[i]=(k-cnt[i])%k;
		sum+=need[i];
	}
	for (int i=n-1; i>=0; --i) {
		int cur=s[i]-'a';
		sum-=need[cur];
		need[cur]=(need[cur]+1)%k;
		sum+=need[cur];
		for (int j=cur+1; j<26; ++j) {
			sum-=need[j];
			need[j]=(need[j]-1+k)%k;
			sum+=need[j];
			if (n-1-i>=sum&&(n-1-i-sum)%k==0) {
				int left=n-1-i-sum;
				cout << s.substr(0,i) << char(97+j);
				while(left--) cout << "a";
				for (int t=0; t<26; ++t) {
					for (int _t=0; _t<need[t]; ++_t) cout << char(97+t);
				}
				return;
			}
			sum-=need[j];
			need[j]=(need[j]+1)%k;
			sum+=need[j];
		}
	}
}

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
#ifdef disastah
	cout << "\nOutput\n\n";
#endif
	int test_case=1;
	cin >> test_case;
	for (int i=0; i<test_case; ++i) {
		solve();
		cout << "\n";
	}
}
