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 <bits/stdc++.h> 
#include <string>
#include <cmath> 
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<pii> vpii;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<vs> vvs;
typedef vector<vc> vvc;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef map<int,int> mpii;
typedef map<int,vi> mpivi;
typedef map<string,int> mpsi;
typedef map<pii,int> map_pair;
typedef set<int> seti;
#define	bits(n)						( (n==0)?0:((int)log2(n)+1) )
#define endl "\n"
#define FOR(i,n) SFOR(i,0,n)
#define SFOR(i,m,n) for(i=m;i<n;i++)
#define FORD(i,n) for(i=n-1;i>=0;i--)
#define digits(i)   (int)((log(i)/log(10))+1)		
#define inf							(int)1e9
#define eps							1e-9
#define pi							3.1415926535897932384626433832795
#define mod							1000000007
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define pb push_back
#define all(s) s.begin(), s.end()
#define sz(s) s.size()
#define si(t) scanf("%d",&(t))
#define ss(t) scanf("%s",(t))
#define sll(t) scanf("%lld",&(t))
#define check_bit(var,pos) ((var) & (1<<(pos)))
#define max(a,b)					( (a) > (b) ? (a) : (b))
#define min(a,b)					( (a) < (b) ? (a) : (b))
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define prn(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define prn(x...)
#endif
struct myfun
{
    public:
bool operator()(pair<double,double> a,pair<double,double>  b)
{
    return a.second/a.first<=b.second/b.first;
}
};

long long inverse(long long a, long long b){
 return 1<a ? b - inverse(b%a,a)*b/a : 1;
}
  
void A()
{
    int t;
    cin>>t;
    for(int kk=0;kk<t;kk++)
    {     
        ll n,k;
        cin>>n>>k;
        string s;
        cin>>s;
        if(n%k)
        {
            cout<<-1<<endl;
            continue;
        }
        vvi vec(n,vi(28,0));
        int sm=0;
        for(int i=0;i<n;i++)
        {
            if(i>0)
            {
                for(int j=0;j<27;j++)
                {
                    vec[i][j]=vec[i-1][j];
                }
            }
            vec[i][(s[i]-'a')]++;
        }
        for(int j=27;j>=0;j--)
        {
            sm+=( k-(vec[n-1][j]%k))%k;
           // prn(vec[0][j],k,sm);
        }
       // prn(sm);
        if(sm==0)
        {
            cout<<s<<endl;
            continue;
        }int done=0;
        for(int i=n-2;i>=-1;i--)
        {
            int  d=s[i+1]+1;
            if(d>'z') continue;
            vec[i+1][s[i+1]-'a']--;
            while(true)
            {
               // prn(i,d);
                if(d>'z') break;
                int p= d-'a';
                vec[i+1][p]++;
                sm=0;
                for(int j=0;j<27;j++)
                {
                    sm+=( k-(vec[i+1][j]%k))%k;
//                    if(i==0)
//                    {
//                       prn((char)d,vec[i+1][j],sm);
//                    }
                }
//                if(i==0)
              // prn(i,d,sm);
                if(sm<=(n-2-i))
                {
                    s[i+1]=d;
                    int j=i+2;
                    //for(int j=i+2;j<n;j++)
                    {
                        for(int p=0;p<27;p++)
                        {
                            while(( k-(vec[i+1][p]%k))%k)
                            {
                                vec[i+1][p]++;
                                s[j]=p+'a';
                                j++;
                            }
                        }
                    }
                    cout<<s<<endl;
                    done=1;
                    break;
                    
                }
                
                vec[i+1][p]--;
                d++;
            
            }
            if(done) break;
        }
        
    }
}
void B()
{
    int t;
    cin>>t;
    for(int kk=0;kk<t;kk++)
    {
      
    }
}
int main() {
    boost;
    #if !ONLINE_JUDGE && !EVAL
    freopen("C:\\Users\\asderfers\\Documents\\codeforce\\hello\\in.txt", "r", stdin);
    //freopen("J.txt", "r", stdin);
    #endif
    A();
    return 0;
} 