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;
template <class T>
void read(T &x) {
  T res = 0, f = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) res = (res << 3) + (res << 1) + c - '0', c = getchar();
  x = res * f;
}
void Printf(long long x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) Printf(x / 10);
  putchar(x % 10 + '0');
}
void print(long long x, char c) { Printf(x), putchar(c); }
const long long maxn = 1e5 + 10;
const long long mod = 1e9 + 7;
const long long inf = 1e9;
long long n, k;
long long a[maxn];
long long cnt[30], b[30];
char s[maxn];
long long sum, y;
void init() {
  for (long long i = 1; i <= 26; i++) cnt[i] = b[i] = 0;
  sum = y = 0;
}
void PPrint(long long l, long long x) {
  for (long long i = 1; i <= l - 1; i++) putchar(a[i] + 'a' - 1);
  if (l <= n) putchar(x + 'a' - 1);
  for (long long i = 1; i <= 26; i++) {
    for (long long j = 1; j <= b[i]; j++) {
      putchar(i + 'a' - 1);
    }
  }
  puts("");
}
int main() {
  long long TT = 1;
  read(TT);
  while (TT--) {
    init();
    read(n), read(k);
    scanf("%s", s + 1);
    if (n % k) {
      puts("-1");
      continue;
    }
    for (long long i = 1; i <= n; i++) {
      a[i] = s[i] - 'a' + 1;
      cnt[a[i]]++;
    }
    for (long long i = 1; i <= 26; i++) {
      b[i] = (k - cnt[i] % k) % k;
      sum += b[i];
    }
    bool f = false;
    if (sum == 0) {
      f = true;
      PPrint(n + 1, 1);
    }
    for (long long i = n; i >= 1; i--) {
      if (f) break;
      y = n - i + 1;
      long long r = b[a[i]];
      b[a[i]] = (b[a[i]] + 1 + k) % k;
      sum -= (r - b[a[i]]);
      cout << ">>>>" << i << ' ' << sum << endl;
      if (y < sum)
        continue;
      else {
        for (long long j = a[i] + 1; j <= 26; j++) {
          if (y == sum && b[j] == 0) continue;
          r = b[j];
          b[j] = (b[j] - 1 + k) % k;
          sum -= (r - b[j]);
          b[1] += y - 1 - sum;
          PPrint(i, j);
          f = true;
          break;
        }
      }
    }
  }
  return 0;
}
