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

                        //    I solemnly swear that I am upto no good //

#include <bits/stdc++.h>
#define sub   freopen("input.txt", "r", stdin);//freopen("output.txt", "w", stdout);
using namespace std;
#define ll long long
#define ld long double
#define ttime cerr << '\n'<<"Time (in s): " << double(clock() - clk) * 1.0 / CLOCKS_PER_SEC << '\n';
#define pb push_back
#define endl "\n"
#define unq(a) sort(all(a));a.resize(unique(all(a)) - a.begin())
#define sz(x) (int)((x).size())
#define input(arr,n) for(ll i1=0;i1<n;i1++ )cin>>arr[i1]
#define fast ios_base::sync_with_stdio(false);cin.tie(0);
#define all(x) x.begin(),x.end()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define mp make_pair
#define ff first
#define ss second
#define YY cout<<"Yes"<<endl
#define NN cout<<"No"<<endl
#define ub upper_bound
#define lb lower_bound
#define A 1000001
const long long INF=1e18;
const long long mod=1000000007;
typedef pair<ll,ll> pairll;
typedef map<ll,ll> mapll;
bool comp(ll a,ll b){
    return a>b;
}
ll n,k;
void solve(){
    string s;
    // ll m;
    cin>>n>>k>>s;

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

    ll ans;
    int low=0, high=n;

    while(low<=high){
        int mid= ( low+ high)/2;
        std::vector<ll> put(200);
        string t;
        for(int i=0;i<mid;i++){
            t.pb(s[i]);
            put[s[i]]= (put[s[i]]+k-1)%k;
        }
        int rem =0;
        rep(i,'a','z'+1){
            rem+=put[i];
        }
        bool ok =0;

        if(rem+mid <= n){
            int d= n-mid-rem;
            rep(i,0,d)t.pb('z');
            for(int i='z'; i>= 'a' ; i--){
                while(put[i]--){
                    t.pb(i);
                }
            }
            ok= (t>=s) ;
        }

        if(ok){
            ans=mid;
            low= mid+1;
        }
        else high = mid -1;
    }

    string t;
    std::vector<ll> put(200);
    for(int i=0;i<ans;i++){
        t.pb(s[i]);
        put[s[i]]= (put[s[i]]+k-1)%k;
    }

    if(ans==n){
        cout<<t<<endl;
        return;
    }

    rep(i,s[ans]+1,'z'+1){

        put[i]=(put[i]-1+k ) %k;
        t.pb(i);

        int rem =0;
        rep(i,'a','z'+1){
            rem+=put[i];
        }
        bool ok =0;
        if(rem+ans+1 <= n){
            int d= n-ans-1-rem;
            rep(i,0,d)t.pb('a');
            for(int i='a'; i<= 'z' ; i++){
                while(put[i]--){
                    t.pb(i);
                }
            }
            ok= (t>=s) ;
        }
        if(ok)break;

        else{
            char c= t.back();
            t.pop_back();
            put[c] = (put[c]+1) % k ;
        }

    }

    cout<<t<<endl;
    

}

int main(){ 
    // sub;    
    fast;
    // pre();
    // clock_t clk = clock();
    ll t=1;
    cin>>t;
    while(t--){
        solve();
    }
    // ttime;
    return 0;
}        

                                // Mischief Managed //            