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 = 100000 + 9;
char s[N];
int cnt[150];
void solve() {
  int n, k;
  scanf("%d %d %s", &n, &k, s + 1);
  if (n % k) {
    printf("-1\n");
    return;
  }
  memset(cnt, 0, sizeof(cnt));
  for (int i = 1; i <= n; ++i) {
    ++cnt[s[i]];
  }
  int ans = 0, x = n / k;
  for (int ch = 'a'; ch <= 'z'; ++ch) {
    ans += (x - cnt[ch] % x) % x;
  }
  if (ans)
    for (int i = n; i >= 1; --i) {
      ans -= (x - cnt[s[i]] % x) % x;
      --cnt[s[i]];
      ans += (x - cnt[s[i]] % x) % x;
      for (int ch = s[i] + 1; ch <= 'z'; ++ch) {
        ans -= (x - cnt[ch] % x) % x;
        ++cnt[ch];
        ans += (x - cnt[ch] % x) % x;
        if (n - i - ans >= 0 && (n - i - ans) % x == 0) {
          s[i] = ch;
          int _ch = 'a';
          for (int j = i + 1; j <= n; ++j) {
            if (n - j > ans) {
              s[j] = 'a';
              ++cnt['a'];
            } else {
              while ((x - cnt[_ch] % x) % x == 0) ++_ch;
              s[j] = _ch;
              ++cnt[_ch];
            }
          }
          goto end;
        }
        ans -= (x - cnt[ch] % x) % x;
        --cnt[ch];
        ans += (x - cnt[ch] % x) % x;
      }
    }
end:
  printf("%s\n", s + 1);
}
int main() {
  int T;
  scanf("%d", &T);
  while (T--) solve();
  return 0;
}
