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

//hail to jwalaji
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
#define uid(a, b) uniform_int_distribution<int>(a, b)(rng)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert

template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

const int MOD = 1000000007;
const char nl = '\n';
const int MX = 100001; //check the limits, dummy

ll get(ll x,ll k){
return (k-x%k)%k;
}
int main() {
    //ios_base::sync_with_stdio(0); cin.tie(0);
    ll t;
    cin>>t;
    while(t--){
        ll n,k;
        cin>>n>>k;
        string s;
        cin>>s;
        vl cnt(26,0);
        F0R(i,sz(s)){
        cnt[s[i]-'a']++;
        }
        ll sum=0,first_sum;
        F0R(i,26){
        sum+=get(cnt[i],k);
        }
        if(sum==0){
            cout<<s<<nl;
            continue;
        }
        if(n%k!=0){
            cout<<-1<<nl;
            continue;
        }
        for(ll i=n-1;i>=0;--i){
            sum-=get(cnt[s[i]-'a'],k);
            cnt[s[i]-'a']--;
            sum+=get(cnt[s[i]-'a'],k);
            FOR(j,s[i]-'a'+1,26){
                first_sum=sum;
            sum-=get(cnt[j],k);
            cnt[j]++;
            sum+=get(cnt[j],k);
            if(sum+i<n){
                F0R(l,i){
                cout<<s[l];
                }
                cout<<char('a'+j);
                string add="";
                F0R(h,26){
                ll f=get(cnt[h],k);
                F0R(sex,f){
                add+=char('a'+h);
                }
                }
                FOR(sex,i+sz(add)+1,n){
                add+="a";
                }
                sort(all(add));
                //cout<<"add : ";
                cout<<add<<nl;
                goto last;;
            }
            cnt[j]--;
            sum=first_sum;
            }
        }
        last:;
    }

    return 0;
}

// read the question correctly (ll vs int)
// template by bqi343
