#include <bits/stdc++.h>
//v.erase(unique(v.begin(),v.end()),v.end());
#define ff first
#define ss second
#define pb push_back
#define sz(v) (ll)v.size()
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
typedef double ld;
typedef long long ll;
const ll N = 1e+5 + 100;
const ll INF = 1e+18;
const ll RT = 5;
const ll mod = 7340033;
const ll MAXN = 1<<20;
 
using namespace std;
 
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << endl;}
 
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1<<" | ";
  __f(comma+1, args...);}
#else
#define trace(...)
#endif
 
int arr[27][N];
int falta[27];



void solve(){
    int n, k; cin >> n >> k;
    string s; cin >> s;
    for(int i = 0; i < 27; i++) for(int j = 0; j < n + 5; j++) arr[i][j] = 0;
    if(n % k != 0){
        cout << -1 << endl;
        return;
    }
    
    for(int j = 1; j <= n; j++){
        for(int i = 0; i < 26; i++){
            if(i == s[j - 1] - 'a') arr[i][j] = arr[i][j - 1] + 1;
            else arr[i][j] = arr[i][j - 1];
        }
    }
    //primero si ya cumple
    bool cumple = true;
    for(int i = 0; i < 26; i++){
        if(arr[i][n] % k != 0) cumple = false;
    }
    if(cumple){
        cout << s << endl;
        return;
    }
    for(int i = n; i >= 1; i--){
        //si se detiene ah
        bool raaa = false;
        for(int j = 0; j < 26; j++){
            int w = arr[j][i - 1] % k;
            w = k - w;
            if(w == k) w = 0;
            falta[j] = w;
        }
        
        
        int csmr;
        for(int j = s[i - 1] - 'a' + 1; j < 26; j++){
            int ac = 0;
            //el nuevo caracter reemplazado
            csmr = falta[j] - 1;
            if(csmr < 0) csmr += k;
            ac = csmr;
            for(int w = 0; w < 26; w++) if(w != j) ac += falta[w];
            
            if(ac <= n - i){
                //si se puede
                for(int w = 0; w < i - 1; w++) cout << s[w];
                cout << (char)(j + 'a');
                for(int w = 0; w < n - i - ac; w++) cout << 'a';
                for(int w = 0; w < 26; w++){
                    for(int z = 0; z < (w == j ? csmr : falta[w]); z++) {
                        cout << (char)(w + 'a');
                    }
                }
                cout << endl;
                return;
            }
        }
        
        
    }
    
    
    
}
 
int main(){
    int t = 1;
    cin >> t;
    while(t--) solve();
    return 0;
}