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<cstdio>
#include<cstring>
#define  N  210000
using  namespace  std;
int  need[30],now[30],cnt;
int  n,k;
int  pre;
char  st[N];
inline  bool  check(int  x)
{
	if(now[x]==need[x])
	{
		if(cnt==n)return  0;
		need[x]+=k,cnt+=k;
	}
	now[x]++;
	return  1;
}
inline  int  findc(int  limit)
{
	if(limit==25)return  -1;
	else  if(cnt<n)return  limit+1;
	else
	{
		for(int  i=limit+1;i<=25;i++)
		{
			if(now[i]<need[i])return  i;
		}
		return  -1;
	}
}
int  main()
{
	int  T;scanf("%d",&T);
	while(T--)
	{
		pre=1;memset(need,0,sizeof(need));
		memset(now,0,sizeof(now));cnt=0;
		scanf("%d%d",&n,&k);
		scanf("%s",st+1);
		if(n%k!=0)printf("-1");
		else
		{
			need[st[1]-'a']+=k;
			now[st[1]-'a']++;cnt+=k;
			bool  bk=1;//用来存是否能够相等，主动break=0 
			for(int  i=2;i<=n;i++)
			{
				int  type=0;
				if((type=findc(st[i]-'a'))!=-1)
				{
					if(now[type]<need[type]  ||  cnt<n)pre=i;//考虑一下放他上一个的情况
				}
				if(check(st[i]-'a')==0)
				{
					bk=0;
					break;
				}
			}
			if(bk==1)printf("%s",st+1);
			else
			{
				memset(need,0,sizeof(need));
				memset(now,0,sizeof(now));
				cnt=0;
				for(int  i=1;i<pre;i++)
				{
					check(st[i]-'a');
					printf("%c",st[i]);
				}
				int  shit=findc(st[pre]-'a');
				check(shit);
				printf("%c",shit+'a');
				need[0]+=n-cnt;
				for(int  i=0;i<=25;i++)
				{
					while(now[i]<need[i])
					{
						printf("%c",i+'a');
						now[i]++;
					}
				}
			}
		}
		printf("\n");
	}
	return  0;
}