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 fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define It it=se.begin();it!=se.end();it++
#define mem(dp,i) memset(dp,i,sizeof(dp))
#define all(x) begin(x),end(x)
#define unmap unordered_map
#define pii pair<int,int>
#include <bits/stdc++.h>
#define pll pair<ll,ll>
#define vll vector<ll>
#define vi vector<int>
#define ld long double
#define ll long long
#define pb push_back
#define sh short int
#define mid (l+r)/2
#define S second
#define F first
#define sqr 708
using namespace std;
const int inf = 1e9+9;
const int mod = 1e9+7;
const int shift = 1e4;
const ld pai=acos(-1);
int n,k;
int mp[29];
string s;
void solve(){
    cin>>n>>k>>s;
    if(n%k != 0){
        cout<<"-1"<<endl;
        return;
    }
    for(int i=0;i<26;i++){
        mp[i] = 0;
    }
    for(int i=0;i<n;i++){
        mp[s[i]-'a']++;
    }
    bool yes = 1;
    for(int i=0;i<26;i++){
        if(mp[i]%k != 0) yes = 0;
    }
    if(yes == 1){
        cout<<s<<endl;
        return;
    }
    reverse(all(s));
    for(int i=0;i<n;i++){
        mp[s[i]-'a']--;
        if(s[i] == 'z') continue;
        char ch = s[i]+1;
        int id = s[i]-'a';
        for(int j=id+1;j<26;j++){
            if(mp[j] > 0){
                ch = j+'a';
                break;
            }
        }
        mp[ch-'a']++;
        int K = i;
        for(int j=0;j<26;j++){
            int x = mp[j]%k;
            if(x == 0) continue;
            if(k-x > K){
                K = -1; break;
            }
            K -= k-x;
        }
        if(K != -1 && K%k == 0){
            s[i] = ch;
            int id = i-1;
            while(K--) s[id] = 'a',id--;
            for(int j=0;j<26;j++){
                while(mp[j]%k != 0){
                    s[id] = j+'a';
                    id--,mp[j]++;
                }
            }
            reverse(all(s));
            cout<<s<<endl;
            return;
        }
        mp[ch-'a']--;
    }
    cout<<"-1"<<endl;
}
int main(){
    int t = 1;
    fast,cin>>t;
    while(t--) solve();
}
