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 INF = 0x3f3f3f3f, N = 1e5 + 10;
template <class T>
inline bool chkmin(T &first, const T &second) {
  return second < first ? first = second, 1 : 0;
}
template <class T>
inline bool chkmax(T &first, const T &second) {
  return first < second ? first = second, 1 : 0;
}
int n, K;
char str[N], ans[N];
int cnt[30];
int main() {
  int cas;
  scanf("%d", &cas);
  while (cas--) {
    int f = 1;
    scanf("%d%d%s", &n, &K, str + 1);
    for (int i = (1), i_end = (n); i <= i_end; ++i) cnt[str[i] - 'a']++;
    for (int i = (0), i_end = (25); i <= i_end; ++i)
      if (cnt[i] % K) f = 0;
    if (f) {
      printf("%s\n", str + 1);
      continue;
    }
    for (int i = (n), i_end = (1); i >= i_end; --i)
      if (str[i] != 'z') {
        int f1 = -1, num = 0;
        memset(cnt, 0, sizeof(cnt));
        for (int j = (1), j_end = (i - 1); j <= j_end; ++j) ++cnt[str[j] - 'a'];
        for (int j = (str[i] - 'a' + 1), j_end = (25); j <= j_end; ++j)
          if (cnt[j] % K) {
            ++cnt[f1 = j];
            break;
          }
        if (f1 == -1) ++cnt[f1 = str[i] - 'a' + 1];
        for (int j = (0), j_end = (25); j <= j_end; ++j)
          if (cnt[j] % K) num += K - cnt[j] % K;
        if (num <= n - i && (n - i - num) % K == 0) {
          str[i] = f1 + 'a';
          for (int j = (n), j_end = (i + 1); j >= j_end; --j) {
            int f2 = 0;
            for (int k = (25), k_end = (0); k >= k_end; --k)
              if (cnt[k] % K) {
                str[j] = 'a' + k;
                ++cnt[k];
                f2 = 1;
                break;
              }
            if (!f2) str[j] = 'a';
          }
          printf("%s\n", str + 1);
          f = 1;
          break;
        }
      }
    if (!f) puts("-1");
  }
  return 0;
}
