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 MAXN = 100051;
int t, n, k;
char s[MAXN];
int bx[31];
int main() {
  scanf("%d", &t);
  while (t--) {
    scanf("%d%d", &n, &k);
    scanf("%s", s + 1);
    if (n % k != 0) {
      printf("-1\n");
      continue;
    }
    memset(bx, 0, sizeof(bx));
    int nm = 0;
    int pos = 1;
    for (int i = 1; i <= n; i++) {
      if ((++bx[s[i] - 'a']) % k == 1)
        nm += k - 1;
      else
        nm--;
      if (i + nm > n) break;
      if (nm % k != (n - i) % k) continue;
      if (i == n) pos = n + 1;
      if (i + nm + k <= n && s[i] < 'z')
        pos = i + 1;
      else
        for (int j = 25; j > s[i] - 'a'; j--)
          if (bx[j] % k > 0) pos = i + 1;
    }
    if (pos == n + 1) {
      printf("%s\n", s + 1);
      continue;
    }
    memset(bx, 0, sizeof(bx));
    nm = 0;
    for (int i = 1; i < pos; i++) {
      if ((++bx[s[i] - 'a']) % k == 1)
        nm += k - 1;
      else
        nm--;
    }
    if (bx[s[pos] + 1 - 'a'] % k != 0 || pos + nm + k - 1 <= n) {
      s[pos]++;
      nm += k;
      bx[s[pos] - 'a']++;
    } else {
      for (int i = s[pos] - 'a' + 1; i < 26; i++) {
        if (bx[i] % k != 0) {
          s[pos] = i + 'a';
          bx[i]++;
          break;
        }
      }
    }
    int nw = pos;
    for (int i = 1; i <= n - pos - nm + 1; i++) s[++nw] = 'a';
    for (int i = 0; i < 26; i++) {
      for (int j = 1; j <= k - (bx[i] + k - 1) % k - 1; j++) s[++nw] = 'a' + i;
    }
    printf("%s\n", s + 1);
  }
  return 0;
}
