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;
int _ = 1;
void solve() {
  int n, k;
  string s;
  cin >> n >> k >> s;
  if (n % k != 0) {
    cout << -1 << '\n';
    return;
  }
  vector<int> cnt(26);
  vector<int> a(26);
  for (int i = 0; i < n; 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 << '\n';
    return;
  }
  int pos = -1;
  int last = -1;
  for (int i = 0; i < n; i++) {
    for (int f = s[i] - 'a' + 1; f < 26; f++) {
      a[f]++;
      int left = n - i - 1;
      for (int j = 0; j < 26; j++) {
        int need = 0;
        if (a[j] % k != 0) {
          need = k - (a[j] % k);
        }
        left -= need;
      }
      a[f]--;
      if (left >= 0) {
        pos = i;
        last = f;
        break;
      }
    }
    a[s[i] - 'a']++;
  }
  if (pos == -1) {
    for (int i = 0; i < n; i++) cout << 'z';
    cout << '\n';
    return;
  }
  s[pos] = last + 'a';
  a.clear();
  a.resize(26, 0);
  for (int i = 0; i <= pos; i++) {
    a[s[i] - 'a']++;
  }
  string temp;
  int z = 0;
  int left = n - pos - 1;
  int mn = 0;
  for (int i = 0; i < 26; i++) {
    if (z && a[i]) {
      int need = 0;
      if (a[i] % k) need = k - a[i] % k;
      while (need--) {
        temp += ('a' + i);
        left--;
      }
    } else if (a[i]) {
      z = 1;
      mn = i;
    }
  }
  string y = "";
  while (left > 0) {
    y += ('a' + mn);
    left--;
  }
  cout << s.substr(0, pos + 1) + y + temp << endl;
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> _;
  while (_--) solve();
  return 0;
}
