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;
  cin >> n >> k;
  string s;
  cin >> s;
  if (n % k != 0) {
    cout << -1 << "\n";
    return;
  }
  int niz[26] = {0};
  string res = "";
  for (int i = 0; i < n; i++) {
    niz[s[i] - 'a']++;
  }
  for (int i = 0; i < 26; i++) {
    if (niz[i] % k != 0) break;
    if (i == 25) {
      cout << s << "\n";
      return;
    }
  }
  for (int i = n - 1; i >= 0; i--) {
    niz[s[i] - 'a']--;
    if (s[i] == 'z') continue;
    int treba = 0;
    bool veci = false;
    for (int j = 0; j < 26; j++) {
      if (niz[j] == 0) continue;
      treba += ((niz[j] - 1) / k + 1) * k - niz[j];
      if (j > s[i] - 'a' && ((niz[j] - 1) / k + 1) * k - niz[j] > 0) {
        veci = true;
      }
    }
    if (treba > n - i) continue;
    if (!veci && treba == n - i) continue;
    for (int j = 0; j < i; j++) {
      res += s[j];
    }
    int koji = -1;
    if (treba == n - i) {
      koji = -1;
      for (int j = s[i] - 'a' + 1; j < 26; j++) {
        if (niz[j] == 0) continue;
        if (((niz[j] - 1) / k + 1) * k - niz[j] > 0) {
          koji = j;
          res += char('a' + j);
          break;
        }
      }
    }
    if (treba != n - i) {
      if (niz[s[i] - 'a' + 1] == 0 || (((niz[s[i] - 'a' + 1] - 1) / k + 1) * k -
                                       niz[s[i] - 'a' + 1]) == 0) {
        niz[s[i] - 'a' + 1] += 1;
        treba += k;
        res += s[i] + 1;
      }
    }
    niz[0] += n - i - treba;
    for (int j = 0; j < 26; j++) {
      if (niz[j] == 0) continue;
      int wtf = ((niz[j] - 1) / k + 1) * k - niz[j] - int(j == koji);
      while (wtf--) res += char('a' + j);
    }
    break;
  }
  cout << res << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  cin >> t;
  while (t--) solve();
  return 0;
}
