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

// Created by ash_98
 
#include<bits/stdc++.h>
using namespace std;


 
#define mx 100005
#define ll long long
#define mod 1000000007
 
int ar[mx];
char ch[mx];
int n,m,ii,k;
vector<int>g[30];
int pre[mx][26];

void Clear()
{
	for(int i=0;i<28;i++)g[i].clear();
}

void solve()
{
	 scanf("%d%d",&n,&k);
	 scanf("%s",ch);
	 if(n%k!=0)
	 {
	 	 printf("-1\n");
	 	 return;
	 }

	 for(int i=0;i<n;i++)
	 {
	 	g[ch[i]-'a'].push_back(i);
	 	for(int j=0;j<=25;j++)pre[i+1][j]=pre[i][j];
	 	pre[i+1][ch[i]-'a']++;
	 }

	 bool f=false;

	 for(int i=0;i<26;i++)
	 {
	 	if((int)g[i].size()%k!=0)f=true;

	 }

	 if(!f)
	 {
	 	printf("%s\n",ch );
        Clear();
	 	return;
	 }

	 int baki=0;


	 for(int i=n-1;i>=0;i--)
	 {
	 	
	 	int ace=ch[i]-'a';

	 	if(ace==25){
	 		baki++;
	 		continue;
	 	}

	 	int need=0;
	 	for(int j=0;j<=ace;j++)
	 	{
	 	   if(pre[i][j]%k!=0)
	 	   {


            need+=k-(pre[i][j]%k);
           
           }
	 	}

	 	int need1=0;
	 	for(int j=ace+1;j<=25;j++)
	 	{
	 		if(pre[i][j]%k!=0)
            need1+=k-(pre[i][j])%k;
	 	}

	 	//cout<<need1<<" "<<need<<endl;
	 //	debug(),dbg(baki);


	 	for(int j=ace+1;j<=25;j++)
	 	{
             int ekhn=0;
             if(pre[i][j]%k!=0)ekhn=k-(pre[i][j])%k;
             int tem=need1-ekhn;

             int nl=(pre[i][j]+1);
             int nlagbe=0;
             if(nl%k!=0)nlagbe=k-(nl%k);

             int tot=need+tem+nlagbe;

            // debug(),dbg(tot),dbg(nlagbe),dbg(need),dbg(baki);
          
             if(tot<=baki && (baki-tot)%k==0)
             {
             	
                 f=false;
                 for(int l=0;l<i;l++)printf("%c",ch[l]);
                 printf("%c",'a'+j);

                 int ex=(baki-tot)/k;
                 for(int l=0;l<ex*k;l++)printf("a");

                 for(int l=0;l<j;l++)
                 {
                 	int xx=0;
                 	if(pre[i][l]%k!=0)xx=k-(pre[i][l]%k);

                 	for(int z=0;z<xx;z++)printf("%c",'a'+l);
                 }

                 for(int z=0;z<nlagbe;z++)printf("%c",'a'+j);

                 for(int l=j+1;l<26;l++)
                 {
                 	int xx=0;
                 	if(pre[i][l]%k!=0)xx=k-(pre[i][l]%k);

                 	for(int z=0;z<xx;z++)printf("%c",'a'+l);
                 }
                 printf("\n");
                 break;


             }

	 	}

	 	baki++;

	 	if(!f)break;


	 }

	// cout<<f<<endl;

	Clear();

}
 
int main()
{
	int t=1;
	scanf("%d",&t);
	while(t--)solve();
	return 0;
}