#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ull = unsigned long long;


int get(int x, int k) {
    return (k - x % k) % k;
}

void solve() {
    int cnt[26] = {0};
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;

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

    for (int i = 0; i < n; ++i) {
        cnt[s[i] - 'a'] += 1;
    }

    int sum = 0;
    for (int i = 0; i < 26; ++i) {
        sum += get(cnt[i], k);
    }
    if (sum == 0) {
        cout << s << "\n";
        return;
    }

    for (int i = n - 1; i >= 0; --i) {
        int c = s[i] - 'a';
        sum -= get(cnt[c], k);
        cnt[c] -= 1;
        sum += get(cnt[c], k);

        // cout << i << ", " << s[i] << ", " << cnt[c] << endl;

        int pref = i;
        int suff = n - i - 1;
        // cout << pref << ", " << suff << ", " << sum << endl;
        for (int j = c + 1; j < 26; ++j) {
            int lstsum = sum;
            sum -= get(cnt[j], k);
            cnt[j] += 1;
            sum += get(cnt[j], k);

            if (sum <= suff) { // we have a solution
            	string res = s.substr(0, pref);
            	res += (char)('a' + j);
                string add = "";

                for (int w = 0; w < 26; ++w) {
                    int g = get(cnt[w], k);
                    if (g > 0) {
                        add += string(g, (char)('a' + w));
                    }
                }
                while ((int) add.size() + res.size() < n) {
                	add += 'a';
                }
                sort(add.begin(), add.end());
                // cout << "adding together " << s.substr(0, pref) <<  " and " << add << endl;
                res += add;
                cout << res << '\n';
                return;
            }

            cnt[j] -= 1;
            sum = lstsum;
        }
    }
}

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

    int T;
    cin >> T;

    while (T--) {
        solve();
    }

    return 0;
}