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;
void files() {
  freopen("1.in", "r", stdin);
  freopen("1.out", "w", stdout);
  return;
}
const int MXN = 1e5 + 5;
const long long MOD = 1e9 + 7;
bool pas;
int x[MXN];
int y[MXN];
void sol() {
  int n, k;
  scanf("%d %d", &n, &k);
  char s[n + 5];
  scanf("%s", s);
  if (n % k) {
    printf("%d\n", -1);
    return;
  }
  map<char, int> cnt;
  for (int i = 0; i < n; ++i) cnt[s[i]]++;
  pas = true;
  for (int i = 0; i < 26; ++i)
    if (cnt['a' + i] % k) {
      pas = false;
      break;
    }
  if (pas) {
    printf("%s\n", s);
    return;
  }
  int id = -1;
  for (int i = n - 1; i >= 0 && id == -1; --i) {
    cnt[s[i]]--;
    int fre = 0;
    for (int j = 0; j < 26; ++j) {
      if (cnt['a' + j] != 0)
        fre += (cnt['a' + j] + k - 1) / k * k - cnt['a' + j];
    }
    for (int j = s[i] - 'a' + 1; j < 26; ++j) {
      if (cnt['a' + j] % k) {
        fre--;
      } else {
        fre += k - 1;
      }
      if (fre <= n - i - 1) {
        id = i + 1;
        s[i] = 'a' + j;
        cnt['a' + j]++;
        int ache = n - 1 - i;
        while (ache > fre) s[id++] = 'a', ache--;
        break;
      }
    }
  }
  vector<char> con;
  for (int i = 0; i < 26; ++i) {
    if (cnt['a' + i] == 0) continue;
    int need = (cnt['a' + i] + k - 1) / k * k - cnt['a' + i];
    for (int j = 0; j < need; ++j) s[id++] = 'a' + i;
  }
  if (id == -1)
    printf("%d\n", -1);
  else
    printf("%s\n", s);
}
int main() {
  int tcase = 1;
  scanf("%d", &tcase);
  while (tcase--) {
    sol();
  }
}
