/**
 * author  : UshanGhosh
 * created : 2021-04-24 11:49:45
**/ 

#include<bits/stdc++.h>
using namespace std;

#define    ll      long long
#define    pii     pair<int,int>
#define    vii     vector<int>
#define    vcc     vector<char>
#define    pll     pair<long long, long long>
#define    mem     memset
#define    sof     sizeof
#define    co1     __builtin_popcountll
#define    PB      push_back
#define    UB      upper_bound
#define    LB      lower_bound
#define    MP      make_pair
#define    TS      to_string
#define    F       first
#define    S       second
#define    pi      acos(-1)
#define    mod     (long long)1000000007
#define    inf     (long long)1e18
#define    endl    '\n'

int main()
{
      ios_base::sync_with_stdio(0);
      cin.tie(0);
      int t=1;
      cin>>t;
      while(t--){
            long long a,b,c,d,e,f,i,j,k,m,n,o,x,y;
            cin >> n >> k;
            string s;
            cin >> s;
            if(n%k) {
                  cout << -1 << "\n";;
                  continue;
            }
            ll in = -1;
            ll ch = 'z';
            vii cnt(30, 0);
            for(i=0; i<n; i++) {
                  for(ll ii=s[i]-'a'+1; ii<26; ii++) {
                        //cerr << ii << " ";
                        cnt[ii]++;
                        ll psum = 0;
                        for(j=0; j<26; j++) {
                              psum += ((k-cnt[j]%k)%k);
                        }
                        if(psum+i+1 <= n) {
                              in = i;
                              ch = ii;
                              cnt[ii]--;
                              break;
                        }
                        cnt[ii]--;
                  }
                  cnt[s[i]-'a']++;
            }
            bool ok = true;
            for(i=0; i<26; i++) {
                  if(cnt[i]%k) ok = false;
            }
            if(ok) {
                  cout << s << "\n";
                  continue;
            }
            cnt.assign(30,0);
            string ans, revans;
            for(i=0; i<in; i++) ans.push_back(s[i]), cnt[s[i]-'a']++;
            ans.push_back(ch+'a');
            cnt[ch]++;
            for(i=25; i>=0; i--) {
                  cnt[i] = (k-cnt[i]%k)%k;
                  while(cnt[i]--) revans.push_back(i+'a');
            }
            ll tar = n - ans.size() - revans.size();
            while(tar--) revans.push_back('a');
            reverse(revans.begin(), revans.end());
            ans += revans;
            cout << ans << "\n";
      }
}