#include<bits/stdc++.h>
using namespace std;
#define int long long
inline int Read(){
	register char ss;register int X=0,F=1;
	while(ss=getchar(),(ss<'0'||ss>'9')&&ss!='-');
	if(ss=='-')F=-1;else X=ss-48;
	while(ss=getchar(),ss>='0'&&ss<='9')X=X*10-48+ss;
	return X*F;
}
int T;
int n,k;
string s;
void solve(){
    T=Read();
    while(T--){
        n=Read();
        k=Read();
        cin>>s;
        if(n%k!=0) cout<<"-1"<<endl;
        else{
            int f=0;
            int num[30];
            memset(num,0,sizeof(num));
            for(int j=0;j<=n-1;++j){
                int x=s[j]-'a';
                num[x]++;
            }
            for(int i=n-1;i>=0;i--){
                num[s[i]-'a']--;
                //cout<<1<<endl;
                char ch=s[i]+1;
                int sum=0;
                if(i==n-1) ch--;
                //num[ch-'a']++;
                for(int c=0;c<26;++c){
                    if(num[c]%k!=0){
                        sum+=k-num[c]%k;
                    }
                }
                //num[ch-'a']--;
                for(;ch<='z';ch++){
                    int num1=0;
                    int c=ch-'a';
                    if(num[c]%k!=0) num1=k-num[c]%k;
                    num[c]++;
                    int num2=0;
                    if(num[c]%k!=0) num2=k-num[c]%k;
                    int sum1=sum;
                    sum=sum-num1+num2;
                    num[c]--;
                    //cout<<num1<<" "<<num2<<" "<<ch<<endl;
                    int left=n-i-1;
                    if(sum<=left){
                        num[c]++;
                        f=1;
                        string s1="";
                        for(int j=0;j<i;++j) s1+=s[j];
                        s1+=ch;
                        int l=left-sum;
                        while(l--) s1+='a';
                        for(int c=0;c<26;++c){
                            if(num[c]%k!=0){
                                int l1=k-num[c]%k;
                                char cc=c+'a';
                                while(l1--){
                                    s1+=cc;
                                }
                            }
                        }
                        //cout<<sum<<" "<<left<<endl;
                        cout<<s1<<endl;
                        break;
                    }
                    sum=sum1;
                }
                if(f) break;
            }
            if(!f) cout<<"-1"<<endl;
        }
    }
}
signed main()
{
    //ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    solve();
}
/*
1
3 3
-3 -2 -1
-3 -2 -1
*/