#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <bitset>
#include <cstring>
 
#define getbit(a, i) ((a)>>(i)&1)
#define ll long long
#define x first
#define y second
#define sz(a) ((a).size())
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
#define FOR(i, a, b) for(int i=a, _n=b; i<=_n; ++i)
#define FORD(i, a, b) for(int i=a, _n=b; i>=_n; --i)
using namespace std;
 
const int N = 1e5+5;
int n,k; char s[N];
int cnt[30];
 
int main()
{
    ios::sync_with_stdio();
    cin.tie(0); cout.tie(0);
    ///freopen("a.inp","r",stdin);
 
    int t; cin >> t; while (t--) {
        cin >> n >> k >> (s+1);
        FOR(c, 0, 25) cnt[c] = 0;
 
        int value = 1;
        FOR(i, 1, n) cnt[s[i]-'a'] += 1;
        FOR(c, 0, 25) if (cnt[c] % k) value = 0;
        if (value) {
            cout << (s+1) << '\n';
            continue;
        }
        FOR(c, 0, 25) cnt[c] = 0;
 
        value = -1;
        FOR(i, 1, n) if (s[i] < 'z') {
            int b = -1;
            FOR(c, s[i]-'a'+1, 25) if (cnt[c] % k) {b=c; break;}
            if (b == -1) b = s[i]-'a'+1; cnt[b] += 1;
            int sum = 0; FOR(c, 0, 25) sum += (k-cnt[c]%k)%k;
            if (sum <= n-i && (n-i - sum) % k == 0) value = i;
            cnt[b] -= 1; cnt[s[i]-'a'] += 1;
        } else cnt[25] += 1;
 
        if (n % k) puts("-1"); else {
            if (value == -1) while(true) {};
            FOR(c, 0, 25) cnt[c] = 0;
            FOR(i, 1, value-1) cnt[s[i]-'a'] += 1;
            
            int i = value, b = s[i]-'a'+1, sum = 0;
            cnt[b] += 1; FOR(c, 0, 25) sum += (k-cnt[c]%k)%k;
            if (sum > n-i) {
                cnt[b] -= 1; FOR(c, s[i]-'a'+1, 25) 
                if (cnt[c] % k) {b=c; break;}
                cnt[b] += 1; 
            }
            
            s[i] = 'a'+b;
 
            int c = 25;
            FORD(j, n, i+1) {
                while (c && cnt[c]%k == 0) c -= 1;
                s[j] = 'a'+c; cnt[c] += 1;
            }
            cout << (s+1) << '\n';
        }
    }
}