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

#define _USE_MATH_DEFINES
#include<iostream>
#include<fstream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<climits>
#include<set>
#include<map>
#include<cmath>
#include<iomanip>
#include<iterator>
#include<queue>
#include<stack>
#include<cctype>
#include<deque>
#include<time.h>
#include<bitset>
#include<random>
#include <functional>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<numeric>
#include <chrono>
#include<sstream>
#include <valarray> 
#include<list>
#include<complex>
#include<cassert>

//by Skeef79

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

#pragma warning(disable : 4996)
#pragma comment(linker, "/STACK:16777216")
#define pb push_back
#define en '\n'
#define forn(i,n) for(int i = 0;i<n;i++)
#define for0(i,n) for(int i = 0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define vec vector
#define pii pair<int,int>
#define pll pair<ll,ll>
#define szof(x) int(x.size())
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vector<int>>
#define vvll vector<vector<ll>>

using namespace std;

const int INF = 1000000000 + 1e8;
const ll LINF = 2000000000000000000;

template<typename T> void print(vector<T>& a)
{
	for (int i = 0; i < a.size(); i++)
		cout << a[i] << ' ';
	cout << en;
}

template<typename T> void print(vector<vector<T>>& a)
{
	for (int i = 0; i < a.size(); i++)
	{
		for (int j = 0; j < a[i].size(); j++)
			cout << a[i][j] << ' ';
		cout << en;
	}
}

template <typename T> void input(vector<T>& a)
{
	for (int i = 0; i < a.size(); i++)
		cin >> a[i];
}

template<typename T> void input(vector<vector<T>>& a)
{
	for (int i = 0; i < a.size(); i++)
		for (int j = 0; j < a[i].size(); j++)
			cin >> a[i][j];
}

int cnt[26];

int n, k;
string s;

bool can(int len)
{
	int need = 0;
	for (int i = 0; i < 26; i++)
		need += k - (cnt[i] % k == 0 ? k : cnt[i] % k);
	return need <= len;
}

void solve()
{
	cin >> n >> k;
	cin >> s;

	for (int i = 0; i < 26; i++)
		cnt[i] = 0;

	if (n%k != 0)
	{
		cout << -1 << en;
		return;
	}

	for (auto to : s)
		cnt[to - 'a']++;

	if (can(0))
	{
		cout << s << en;
		return;
	}

	
	for (int i = n-1; i >= 0; i--)
	{
		cnt[s[i] - 'a']--;
		for (char c = s[i] + 1; c <= 'z'; c++)
		{
			cnt[c-'a']++;
			if (can(n - i - 1))
			{
				s[i] = c;
				int need = 0;
				vector<int>cur(26);
				for (int j = 0; j < 26; j++)
				{
					need += k - (cnt[j] % k == 0 ? k : cnt[j] % k);
					cur[j] = k - (cnt[j] % k == 0 ? k : cnt[j] % k);
				}

				int len = n - i - 1;
				int ost = len - need;
				cur[0] += ost;
				int id = 0;
				for (int j = i + 1; j < n; j++)
				{
					if (cur[id] == 0)
					{
						id++;
						j--;
						continue;
					}
					else
					{
						cur[id]--;
						s[j] = char(id + 'a');
					}
				}
				cout << s << en;
				return;
			}
			cnt[c-'a']--;
		}
	}
}

int main()
{
	srand(time(0));
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

#ifdef _DEBUG	
	freopen("input.txt", "r", stdin);
#endif
	//freopen("out.txt", "w", stdout);

	//freopen("igoreha.in", "r", stdin);
	//freopen("igoreha.out", "w", stdout);

	int tst = 1;
	cin >> tst;

	while (tst--)
		solve();
}