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;
using ll = long long;
using PII = pair<int, int>;
using VI = vector<int>;
string solve() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  if (n % k != 0) return "-1";
  VI f(26);
  for (char c : s) f[c - 'a']++;
  int rem;
  auto check = [&](int c, int d) -> bool {
    for (int i = 0; i < 26; i++) {
      if (f[i] % k != 0) {
        d -= k - (f[i] % k);
      }
      if (d < 0) return false;
      if (i == c) ++d;
    }
    rem = d;
    return d >= 0;
  };
  if (check(26, 0)) return s;
  for (int i = n - 1; i >= 0; i--) {
    f[s[i] - 'a']--;
    if (check(s[i] - 'a', n - i - 1)) {
      assert(s[i] != 'z');
      if (f[s[i] - 'a' + 1] % k != 0 || rem > 0) {
        s[i]++;
        f[s[i] - 'a']++;
      } else {
        for (int c = s[i] - 'a' + 1; c < 26; c++) {
          if (f[c] % k != 0) {
            s[i] = c + 'a';
            f[c]++;
          }
        }
      }
      for (int j = n - 1; j > i; j--) {
        s[j] = '*';
        for (int c = 25; c >= 0; c--) {
          if (f[c] % k != 0) {
            s[j] = c + 'a';
            f[c]++;
            break;
          }
        }
        if (s[j] == '*') {
          s[j] = 'a';
          f[0]++;
        }
      }
      return s;
    }
  }
  return "-1";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    cout << solve() << '\n';
  }
  return 0;
}
