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

#include "bits/stdc++.h"
using namespace std;

// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds; 

// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

#define fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
 
 
#define rep(i,a,b)               for(int i=a;i<b;i++)
 
#define pfy                       cout<<("YES")
#define pfn                      cout<<("NO")
 
typedef long long ll;
typedef long double ld;
#define nl                        cout<<("\n")
#define int ll
 
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
typedef vector< ii > vii;
 
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for( auto i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
 
#define F first
#define S second
 
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
 
const int hell=round(9e18);
 
/* */
 
signed solve(){

    int n; cin>>n;
    int k; cin>>k;

    string s; cin>>s;

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

        vector<int> a(26);

        for(int i=0;i<n;i++){
            a[s[i]-'a']++;
        }

        int f1=1;

        for(auto p:a){
            if(p%k!=0) f1=0;
        }

        if(f1==1){
            cout<<s<<endl;
            return 0;
        }

        for(int i=n-1;i>=0;i--){

            int c=n-1-i;
            int ch=s[i]-'a';
            a[ch]--;

            if(ch==25) continue;

            int cnt=0;


            for(int j=0;j<26;j++){

                int p=(a[j]-1+k)%k;    // k-1, 0,1..., k-2
                p= k-p;                // 1, k,....,2
                p--;                   // 0, k-1,..., 1
                cnt+=p;

            }

               
            int f=0;

            if(a[ch+1]%k == 0){
                if(cnt+k-1<=c) {
                    f=1;
                    cnt+=k;
                }
            }

            cnt--;

            // trace(i,c,cnt,ch+1,f);


            if(cnt<=c){

                string t;

                for(int j=0;j<i;j++) t.push_back(s[j]);

                int f1=0;

                for(int j=ch+1;j<26;j++){

                    if((a[j]%k)>0 || f==1){
                        t.push_back('a'+j);
                        a[j]++;
                        f1=1;
                        break;
                    }

                }

                if(f1==0) continue;


                string t1;
                string t2;
                int ctr=0;

                for(int j=i+1; j<n; j++){

                    while(ctr<26 && (a[ctr]%k)==0) ctr++;

                    if(ctr<26){
                        t1.push_back('a'+ctr);
                        a[ctr]++;
                    }else{
                        t2.push_back('a');
                    }

                }

                // trace(i,t,t1,t2);
                cout<<t+t2+t1<<endl;


                return 0;

            }


               


        }



        



    }


    return 0;
}
 
signed main(){
 
    int t=1;
     
    fast;            //  freopen("input.txt","r",stdin); freopen ("output.txt","w",stdout);
    cin>>t;
     
    while(t--){
        solve();
    }
     
    return 0;

}