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>
using namespace std;
void solve() {
  int n, k;
  string s;
  cin >> n >> k >> s;
  if (n % k != 0)
    cout << -1 << endl;
  else {
    int ns = s.size();
    vector<int> cnt(26, 0);
    for (int i = 0; i < ns; i++) {
      cnt[s[i] - 'a']++;
    }
    bool ok = true;
    for (int i = 0; i < 26; i++) {
      if (cnt[i] % k != 0) ok = false;
    }
    if (ok)
      cout << s << endl;
    else {
      int marg = 0;
      int mt = -1;
      for (int i = ns - 1; i >= 0; i--) {
        int left = marg;
        for (int j = 0; j < 26; j++) {
          if (cnt[j] % k != 0) {
            left -= (k - cnt[j] % k);
          }
        }
        while (s[i] != 'z') {
          if (cnt[s[i] - 'a'] % k == 0) {
            left -= (k - 1);
          } else {
            left++;
          }
          cnt[s[i] - 'a']--;
          s[i]++;
          if (cnt[s[i] - 'a'] % k != 0) {
            left--;
          } else {
            left += (k - 1);
          }
          cnt[s[i] - 'a']++;
          if (left >= 0) {
            mt = i;
            break;
          }
        }
        if (mt != -1) break;
        cnt[25]--;
        marg++;
      }
      string add = "";
      int las = 25;
      for (int j = 25; j >= 0; j--) {
        while (cnt[j] % k != 0) {
          add += (char)('a' + j);
          marg--;
          cnt[j]++;
          las = j;
        }
      }
      while (marg > 0) {
        add += (char)('a' + las);
      }
      reverse(add.begin(), add.end());
      cout << s.substr(0, mt + 1) << add << endl;
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) solve();
}
