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


// #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>

using namespace std;

#define khan ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define ll long long
#define pii pair < int, int >
#define pb push_back

const int N = 2e5 + 5, mod = 1e9 + 7, INF = 1e9 + 7;

const ll BIG = 1e18;

int n, k, cnt[30], need[30], ans = -1;

string s, t;

int check(){
    for(int i = 0; i < 26; i++){
        cnt[i] = 0;
    }
    for(int i = 1; i <= n; i++){
        cnt[s[i] - 'a']++;
    }
    for(int i = 0; i < 26; i++){
        if(cnt[i] % k)
            return ans;
    }
    return n;
}

int ret(int i){
    if(i == n)
        return 0;
    for(int j = 0; j < 26; j++){
        cnt[j] = 0;
    }
    for(int j = 1; j <= i; j++){
        cnt[s[j] - 'a']++;
    }
    for(int it = 1; it < 26; it++){
        if(s[i + 1] - 'a' + it >= 26)
            continue;
        cnt[s[i + 1] - 'a' + it]++;
        for(int j = 0; j < 26; j++){
            need[j] = (k - cnt[j] % k) % k;
        }
        int sum = 0;
        for(int j = 0; j < 26; j++){
            sum += need[j];
        }
        int remaining = n - (i + 1);
        if(sum <= remaining and (remaining - sum) % k == 0){
            return it;
        }
        cnt[s[i + 1] - 'a' + it]--;
    }
    return -1;
}

void solve(){
    cin >> n >> k >> s;
    s = '!' + s;
    for(int i = 0; i < n; i++){
        if(i)
            cnt[s[i] - 'a']++;
        for(int it = 1; it < 26; it++){
            if(s[i + 1] - 'a' + it >= 26)
                continue;
            cnt[s[i + 1] - 'a' + it]++;
            for(int j = 0; j < 26; j++){
                need[j] = (k - cnt[j] % k) % k;
            }
            int sum = 0;
            for(int j = 0; j < 26; j++){
                sum += need[j];
            }
            int remaining = n - (i + 1);
            if(sum <= remaining and (remaining - sum) % k == 0){
                ans = i;
            }
            cnt[s[i + 1] - 'a' + it]--;
        }
    }
    ans = check();
//    cout << ans << endl;
    if(ans == -1){
        cout << ans << endl;
        return;
    }
    int letter = ret(ans);
    for(int i = 1; i <= ans; i++){
        t += s[i];
    }
    if(ans + 1 <= n)
        t += s[ans + 1] + letter;
    //    cout << t << endl;
    for(int i = 0; i < 26; i++){
        cnt[i] = 0;
    }
    for(int i = 1; i <= ans; i++){
        cnt[s[i] - 'a']++;
    }
    if(ans + 1 <= n)
        cnt[s[ans + 1] - 'a' + letter]++;
    for(int j = 0; j < 26; j++){
        need[j] = (k - cnt[j] % k) % k;
    }
    int sum = 0;
    for(int j = 0; j < 26; j++){
        sum += need[j];
    }
    int remaining = n - (ans + 1);
    int cool = remaining - sum;
    for(int i = 0; i < cool; i++){
        t += 'a';
    }
    //    cout << t << endl;
    //    cout << remaining << " " << cool << " " << sum << endl;
    //    return 0;
    remaining -= cool;
    for(int i = 0; i < 26; i++){
        for(int j = 0; j < need[i]; j++){
            t += 'a' + i;
        }
    }
    cout << t << endl;
}

void clear(){
    ans = -1;
    t.clear();
    for(int i = 0; i < 26; i++){
        cnt[i] = need[i] = 0;
    }
}

int main(){
    khan
    int q = 1;
    cin >> q;
    while(q--){
        solve();
        clear();
    }
}
