#include <bits/stdc++.h>
using namespace std;
#define me(a, b) memset(a, b, sizeof(a))
#define IOS() ios::sync_with_stdio(false), cin.tie(0)
#define endl '\n'

typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
const int INF = 0x3f3f3f3f;
const int maxn = 2e5 + 5;
const ll mod = 1e9 + 7;

int cnt[26];
int n, k;
vector<pii> ans;
int check()
{
	ans.clear();
	int sum = 0;
	for(int i = 0; i < 26; ++i) {
		int r = cnt[i] % k;
		if(r){
			ans.push_back(pii(i, k - r));
			sum += k - r;
		}
	}
	return sum;
}

void solve()
{
	me(cnt, 0);
	string s;
	cin >> n >> k >> s;
	for(char &c : s)
		++cnt[c - 'a'];
	if(check() == 0) {
		cout << s << endl;
		return ;
	}
	for(int i = s.size()-1; i >= 0; --i) {
		char &c = s[i];
		--cnt[c - 'a'];
		for(int j = s[i] - 'a' + 1; j < 26; ++j) {
			c = j + 'a';
			++cnt[j];
			int sum = s.size()-i-1 - check();
			--cnt[j];
			if(sum >= 0 && sum % k == 0) {
				string t;
				for(int p = 0; p <= i; ++p)
					t.push_back(s[p]);
				t.append(sum, 'a');
				for(pii p : ans) {
					t.append(p.second, p.first+'a');
				}
				cout << t << endl;
				return ;
			}

		}
	}
	cout << "-1\n";
}


int main()
{
	IOS();
	int T;
	cin >> T;
	while(T--)
		solve();
	return 0;
}