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;
string st;
int ch[30], p[30];
int ept(int x) {
  for (int i = x; i <= 25; ++i)
    if (ch[i] < p[i]) return 1;
  return 0;
}
int main() {
  int tmp;
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> tmp;
  int n, k;
  while (tmp--) {
    cin >> n >> k;
    cin >> st;
    memset(ch, 0, sizeof ch);
    st = '?' + st;
    if (n % k != 0) {
      cout << -1 << endl;
      continue;
    }
    int fl = -1, tot, pos, ck = 0;
    tot = 0;
    for (int i = 1; i <= n; ++i) ch[st[i] - 'a']++;
    for (int i = 0; i <= 25; ++i)
      if (ch[i] % k != 0) ck = 1;
    if (ck == 0) {
      for (int i = 1; i <= n; ++i) putchar(st[i]);
      cout << endl;
      continue;
    }
    for (int i = n; i > 1; --i) {
      ch[st[i] - 'a']--;
      int min = 0;
      for (int j = 0; j <= 25; ++j) {
        min = min + (ch[j] + k - 1) / k * k;
      }
      if (min <= n) {
        fl = 1;
      } else
        continue;
      for (int j = 0; j <= 25; ++j) {
        p[j] = (ch[j] + k - 1) / k * k;
      }
      int fll = -1;
      for (int j = 1; j < i; ++j) p[st[j] - 'a']--;
      for (int j = st[i] - 'a' + 1; j <= 25; ++j) {
        if (p[j] > 0) {
          fll = 0;
          break;
        }
      }
      if (fll == -1 && (st[i] - 'a' + 1 == 25 ||
                        (ept(st[i] - 'a' + 1) == 0 && n - min == 0))) {
        continue;
      }
      for (int j = 1; j < i; ++j) putchar(st[j]);
      p[0] += n - min;
      int pos = 0;
      for (int j = st[i] - 'a' + 1; j <= 25; ++j) {
        if (p[j] > 0) {
          fll = 0;
          putchar((char)(j + 'a'));
          break;
        }
      }
      if (fll == -1) {
        p[0] -= k;
        p[st[i] - 'a' + 1] += k - 1;
        putchar((char)(st[i] + 1));
      }
      for (int j = i + 1; j <= n; ++j) {
        while (p[pos] == 0) {
          ++pos;
        }
        putchar((char)(pos + 'a'));
        --p[pos];
      }
      cout << endl;
      break;
    }
    if (fl == -1) cout << -1 << endl;
  }
  return 0;
}
