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;
const int N = 3e5 + 7;
const int M = 4e7 + 7;
const int mod = 1e9 + 7;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int T;
int n, k;
char S[N];
int C[26], D[26];
void solve() {
  scanf("%d%d", &n, &k);
  scanf("%s", S);
  if (n % k) {
    cout << -1 << "\n";
    return;
  }
  memset(C, 0, sizeof(C));
  for (int i = 0; i < n; i++) C[S[i] - 'a']++;
  int ok = 1;
  for (int i = 0; i < 26; i++) ok &= ((C[i] % k) == 0);
  if (ok) {
    printf("%s\n", S);
    return;
  }
  int we = -1;
  int mx = 0;
  for (int i = n - 1; i >= 0 && we == -1; i--) {
    C[S[i] - 'a']--;
    mx = max(mx, S[i] - 'a');
    int tmp = 0;
    vector<int> vec;
    vec.clear();
    for (int j = 0; j < 26; j++) {
      int tt = (k - C[j] % k) % k;
      D[j] = tt;
      if (tt) vec.push_back(j);
      tmp += tt;
    }
    if (tmp > n - i) continue;
    if (tmp == n - i) {
      int cc = 0;
      for (auto v : vec) {
        if (v > mx) {
          cc = 1;
          break;
        }
      }
      if (!cc) continue;
      int j = i;
      int pp = 0;
      for (; j < n && !pp; j++) {
        for (int q = S[j] - 'a'; q < 26; q++) {
          if (D[q]) {
            if (q > S[j] - 'a') pp = 1;
            S[j] = q + 'a';
            D[q]--;
            break;
          }
        }
      }
      for (; j < n; j++) {
        for (int q = 0; q < 26; q++) {
          if (D[q]) {
            S[j] = q + 'a';
            D[q]--;
            break;
          }
        }
      }
      we = n - i;
      continue;
    }
    int tw = n - i - tmp;
    if (S[i] != 'z') {
      S[i] = S[i] + 1;
      D[0] += tw - k;
      D[S[i] - 'a'] += k - 1;
      int pl = i + 1;
      for (int j = 0; j < 26; j++) {
        while (D[j]) {
          S[pl++] = j + 'a';
          D[j]--;
        }
      }
      we = n - i;
      continue;
    }
  }
  printf("%s\n", S);
  return;
}
int main() {
  scanf("%d", &T);
  while (T--) {
    solve();
  }
  return 0;
}
