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 long long sz = 1e5 + 10;
char s[sz];
long long cnt[30], cnt2[30], ase[sz][30], rest[30];
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long k, n;
    scanf("%lld", &n), scanf("%lld", &k);
    scanf("%s", s + 1);
    if (n % k != 0) {
      printf("-1\n");
      continue;
    }
    memset(cnt, 0, sizeof(cnt));
    for (long long i = 0; i < 26; ++i) ase[n + 1][i] = 0;
    for (long long i = n; i >= 1; --i) {
      for (long long j = 0; j < 26; ++j) ase[i][j] = ase[i + 1][j];
      cnt[s[i] - 'a']++;
      ase[i][s[i] - 'a']++;
    }
    bool ok = 1;
    for (long long i = 0; i < 26; ++i) {
      if (cnt[i] % k != 0) {
        ok = 0;
        break;
      }
    }
    if (ok) {
      printf("%s\n", s + 1);
      continue;
    }
    for (long long i = n; i >= 1; --i) {
      if (s[i] == 'z') continue;
      long long now = s[i] - 'a', nxt = -1, rest = n - i + 1;
      for (long long j = 0; j < 26; ++j) cnt2[j] = cnt[j] - ase[i][j];
      for (long long j = now + 1; j < 26; j++) {
        long long d = cnt2[j] / k;
        rest = n - i + 1;
        long long full = (d + 1) * k, need = full - cnt2[j];
        if (need > (n - i + 1)) continue;
        nxt = j;
        cnt2[j] += need, rest -= need;
        long long got = 1;
        for (long long jj = 0; jj < 26; ++jj) {
          if (cnt2[jj] % k == 0) continue;
          long long d = cnt2[jj] / k;
          long long full = (d + 1) * k, need = full - cnt2[jj];
          if (need > rest) {
            got = 0;
            break;
          }
          cnt2[jj] += need, rest -= need;
        }
        if (!got) continue;
        ok = 1;
        break;
      }
      if (!ok) continue;
      long long idx = i;
      s[idx++] = (nxt + 'a'), cnt2[nxt]--;
      for (long long j = 0; j < 26; ++j) {
        long long age = cnt[j] - ase[i][j];
        long long ext = cnt2[j] - age;
        ext += rest;
        rest = 0;
        for (long long jj = 1; jj <= ext; ++jj) s[idx++] = (j + 'a');
      }
      break;
    }
    printf("%s\n", s + 1);
  }
  return 0;
}
