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

//wtrl,everybody hangbeat me
#include<bits/stdc++.h>
/*#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>*/
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<pii> vii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef pair<ll,ll> pll;
/*=====================================================================*/
#define pb push_back
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define sz(a) (int)(a.size())
#define all(s) (s).begin(),(s).end()
#define m_p make_pair
#define repd(i,n) for(int i=n-1;i>=0;i--)
#define forn(i,p,n) for(int i=p;i<=n;i++)
#define ford(i,p,n) for(int i=n;i>=p;i--)
#define foreach(i,c) for(__typeof(c.begin())i=(c.begin());i!=(c).end();++i)
#define INF 1e9
#define PI acos(-1)
/*=====================================================================*/
string int_to_string(ll n)
{
	string s="";
	while(n)
	{
		ll now=n%10;
		s+=now+'0';
		n/=10;
	}
	reverse(s.begin(),s.end());
	return s;
}
ll string_to_int(string s)
{
	ll n=0;
	rep(i,s.size())
	{
		n*=10;
		n+=s[i]-'0';
	}
	return n;
}
/*======================================================================*/
ll lcm(int a,int b)
{
	return a/__gcd(a,b)*b;
}
bool prime(int n)
{
	if(n==0||n==1)
	  return false;
	for(int i=2;i*i<=n;i++)
	  if(n%i==0)
	    return false;
	return true;
}
/*======================================================================*/
const int dx[]={-1,0,1,0};
const int dy[]={0,-1,0,1};
const int month[2][12]={{31,28,31,30,31,30,31,31,30,31,30,31},{31,29,31,30,31,30,31,31,30,31,30,31}};
int cnt[30];
int n,m;
string ans;
bool check(string s)
{
	ans="";
	rep(i,s.size())
	{
		bool f=0;
		forn(j,s[i]-'a',26)
		{
			if(cnt[j]>0)
			{
				cnt[j]--;
				ans+=(char)(j+'a');
				//cout<<t<<endl;
				f=1;
				break;
			}
		}
		if(!f)
		{
			return 0;
		}
	}
	return 1;
}
/*======================================================================*/
int main()
{
    std::ios::sync_with_stdio(false);
  /*
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
  */
  /*====================================================================*/
  int t;
  cin>>t;
  while(t--)
  {
  	memset(cnt,0,sizeof(cnt));
    cin>>n>>m;
  	string s;
  	cin>>s;
  	if(n%m||s.size()>n)
  	{
  		cout<<-1<<endl;
  		continue;
	}
  	if(s.size()<n)
  	{
  	  forn(i,s.size()+1,n)
  	  {
  	    s+='z';	
	  }
	}
	rep(i,n/m)
	{
		cnt[s[i]-'a']+=m;
	}
	if(check(s))
	{
		//cout<<1<<endl;
		cout<<ans<<endl;
	}
	else
	{
		memset(cnt,0,sizeof(cnt));
		repd(i,n/m)
		{
			if(s[i]!='z')
			{
				s[i]++;
				break;
			}
			else
			{
				s[i]='a';
			}
		}
		rep(i,n/m)
		{
			cnt[s[i]-'a']+=m;
		}
		rep(i,n/m)
		{
		  cout<<s[i];
		  cnt[s[i]-'a']--;
		}
		rep(i,26)
		{
			while(cnt[i]>0)
			{
				cout<<(char)(i+'a');
				cnt[i]--;
			}
		}
		cout<<endl;
	}
  }
  return 0;
}
/*
注意数组越界，vector长度为0的时候循环会RE
注意输入顺序
注意循环时int*int爆ll
*/



