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 double pi = acos(-1.0);
const double eps = 1e-10;
const int MOD = 998857459;
const int INF = 0x3f3f3f3f;
const int maxn = 2e5 + 10;
const int maxm = 1e7 + 10;
char str[maxn];
int n, k, cnt[100];
bool check(int pos, char ch) {
  if (str[pos] == 'z') return 0;
  int sum = 0;
  ++cnt[ch - 'a'];
  for (int i = 0; i < 26; ++i) sum += (k - cnt[i] % k) % k;
  --cnt[ch - 'a'];
  if (sum > n - pos || (n - pos - sum) % k) return 0;
  return 1;
}
int main() {
  int __;
  cin >> __;
  while (__--) {
    cin >> n >> k;
    scanf("%s", str + 1);
    if (n % k) {
      cout << -1 << '\n';
      continue;
    }
    for (int i = 1; i <= n; ++i) ++cnt[str[i] - 'a'];
    int f = 0;
    for (int i = 0; i < 26; ++i)
      if (cnt[i] % k) f = 1;
    if (!f) {
      for (int i = 0; i < 26; ++i) cnt[i] = 0;
      printf("%s\n", str + 1);
      continue;
    }
    for (int i = n; i >= 1; --i) {
      --cnt[str[i] - 'a'];
      if (check(i, str[i] + 1)) {
        f = 0;
        ++str[i];
        ++cnt[str[i] - 'a'];
        int sum = 0;
        for (int j = 0; j < 26; ++j) sum += (k - cnt[j] % k) % k;
        int t = n - i - sum, now = i;
        while (t--) str[++now] = 'a';
        for (int j = 0; j < 26; ++j) {
          t = (k - cnt[j] % k) % k;
          while (t--) str[++now] = j + 'a';
        }
        break;
      }
      if (str[i - 1] > str[i] && check(i, str[i - 1])) {
        f = 0;
        str[i] = str[i - 1];
        ++cnt[str[i] - 'a'];
        int sum = 0;
        for (int j = 0; j < 26; ++j) sum += (k - cnt[j] % k) % k;
        int t = n - i - sum, now = i;
        while (t--) str[++now] = 'a';
        for (int j = 0; j < 26; ++j) {
          t = (k - cnt[j] % k) % k;
          while (t--) str[++now] = j + 'a';
        }
        break;
      }
    }
    for (int i = 0; i < 26; ++i) cnt[i] = 0;
    printf("%s\n", str + 1);
  }
  return 0;
}
