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>
#include<math.h>

using namespace std;

#define ll long long

#define vi vector<int>

#define vc vector<char>

#define vl vector<ll>

#define ip pair<int, int>

#define cip pair<int, char>

#define vip vector<ip>

#define FOR(d) for(int i = 0; i < d; ++i)

#define FORD(d) for(int i = d - 1; i >= 0; i--)

#define FORM(d, d1) for(int i = 0; i < d; ++i){for(int j = 0; j < d1; ++j)

#define FORV(v) FOR(v.size())

#define FORVD(v) FORD(v.size())

#define INA(a, d) FOR(d) { cin >> a[i]; }

#define INM(a, d, d1) FORM(d, d1) { cin >> a[i][j];}}

#define OUTA(a, d) FOR(d) { cout << a[i] << " "; }

#define OUTM(c, d, d1) FORM(d, d1) { cout << c[i][j] << " "; } cout << endl;}

// a b a a b a a a a
// 2 4 3 2 1 3 2 1 3

void solve() {
	int n, k;
	cin >> n >> k;

	char a[n];

	char sol[n];

	FOR(n) {
		sol[i] = 'a';
	}

	INA(a, n);

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

	map<char, int> lc;

	for(int i = 0; i < 26; i++) {

        char c = 'a' + i;

		lc.insert({c, 0});
	}

	int total = 0;

    int maxc = -1;
    int cOff = 1;
	FOR(n) {
		int ae = n - i - 1;
		for(int j = 1; j < 'z' - a[i] + 1; j++) {
            int ct = total;
            if(lc[a[i] + j] % k == 0) {
                ct += k - 1;
            } else {
                ct--;
            }

            //cout << "J : " << j << " CT: " << ct << endl;
            if(ct <= ae) {
                maxc = i;
                cOff = j;
                break;
            }
		}
		if(lc[a[i]] % k == 0) {
			total += k - 1;
		} else {
			total--;
		}
		lc[a[i]]++;
	}

    bool isPerfect = true;

    for(int i = 0; i < 26; i++) {
        if(lc['a' + i] % k != 0) {
            isPerfect = false;
        }
    }

    if(isPerfect) {
        FOR(n) {
            cout << a[i];
        }
        cout << endl;
        return;
    }


	for(int i = 0; i < 26; i++) {

        char c = 'a' + i;

		lc[c] = 0;
	}

	//cout << maxc << endl;

	FOR(maxc) {
        lc[a[i]]++;
        sol[i] = a[i];
	}

	lc[a[maxc] + cOff]++;
	sol[maxc] = a[maxc] + cOff;

    int pnt = n - 1;

    for(int i = 25; i > -1; i--) {
        char letter = 'a' + i;
        int letterC = k - (lc['a' + i] % k);
        if(letterC == k) {
            letterC = 0;
        }
        for(int j = 0; j < letterC; j++) {
            sol[pnt] = 'a' + i;
            pnt--;
        }
    }

	FOR(n) {
        cout << sol[i];
	}
	cout << endl;
}

int main() {
    int t;
    cin >> t;
    FOR(t) {
        solve();
    }
}
