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<iostream>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
#include<cstdio>
#include<algorithm>
#define debug(a) cout<<#a<<"="<<a<<endl;
using namespace std;
const int maxn=1e5+10;
typedef long long LL;
inline LL read(){LL x=0,f=1;char ch=getchar();	while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}while (isdigit(ch)){x=x*10+ch-48;ch=getchar();}
return x*f;}
LL sum[maxn][30];
char str[maxn];
LL tran(char s){
    return (s-'a'+1);
}
LL get(LL pos,LL num,LL mod){
      return (mod-sum[pos][num]%mod)%mod;
}
int main(void)
{
  cin.tie(0);std::ios::sync_with_stdio(false);
  LL T;cin>>T;
  while(T--){
      LL n,k;cin>>n>>k;
      for(LL i=0;i<n+5;i++){
        for(LL j=1;j<=26;j++) sum[i][j]=0;
      }
      cin>>(str+1);
      for(LL i=1;i<=n;i++){
        for(LL j=1;j<=26;j++){
            sum[i][j]=sum[i-1][j];
        }
        sum[i][tran(str[i])]++;
      }
      if(n%k!=0){
        cout<<"-1"<<"\n";
        continue;
      }
      LL g=0;
      for(LL j=1;j<=26;j++){
         g+=get(n,j,k);
      }
      if(g==0){
        for(LL j=1;j<=n;j++) cout<<str[j];
        cout<<"\n";
        continue;
      }
      bool flag=1;
      for(LL i=n;1==flag&&i>=1;i--){///枚举第i位是否可以>
          for(char o=str[i]+1;o<='z';o++){
              LL pre=tran(str[i]);
              LL j=tran(o);
              sum[i][pre]--;
              sum[i][j]++;
              LL ans=0;
              for(LL p=1;p<=26;p++){
                ans+=get(i,p,k);
              }
              if(ans<=n-i+1){
                for(LL pos=1;pos<=i-1;pos++) cout<<str[pos];
                cout<<o;
                LL cnt=(n-i-ans);
                for(LL pos=1;pos<=cnt;pos++) cout<<"a";
                for(char ace='a';ace<='z';ace++){
                    LL num=get(i,tran(ace),k);
                    while(num>0) cout<<ace,num--;
                }
                cout<<"\n";
                flag=0;
                break;
              }
              sum[i][j]--;
              sum[i][pre]++;
          }
      }
      if(1==flag) cout<<"-1"<<"\n";
  }
return 0;
}