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 = 1e5 + 5;
int n, k, num[N][30];
char s[N], ans[N];
void print1(int pos, char t) {
  for (int i = 1; i < pos; i++) cout << s[i];
  cout << t;
}
void print2(int pos, int adjust) {
  for (int i = 1; i <= adjust; i++) cout << "a";
  for (int j = 0; j < 26; j++) {
    for (int i = 1; i <= k - num[pos - 1][j]; i++) {
      char t = 'a' + j;
      cout << t;
    }
  }
  cout << endl;
}
int add(int x) { return x % k + 1; }
void solve() {
  cin >> n >> k;
  for (int j = 0; j < 26; j++) num[0][j] = k;
  for (int i = 1; i <= n; i++) {
    cin >> s[i];
    for (int j = 0; j < 26; j++) num[i][j] = num[i - 1][j];
    num[i][s[i] - 'a'] = num[i][s[i] - 'a'] % k + 1;
  }
  for (int j = 0; j < 26; j++) {
    if (num[n][j] < k) break;
    if (j == 25) {
      print1(n, s[n]);
      return;
    }
  }
  for (int i = n + 1; i; i--) {
    if (s[i] == 'z') continue;
    int adjust = n - i;
    for (int j = 0; j < 26; j++) adjust -= k - num[i - 1][j];
    if (adjust < -1) continue;
    if (adjust == -1) {
      for (int j = s[i] - 'a' + 1; j < 26; j++) {
        if (num[i - 1][j] < k) {
          print1(i, j + 'a');
          num[i - 1][j] = add(num[i - 1][j]);
          print2(i, 0);
          return;
        }
      }
    } else if ((adjust + 1) % k == 0) {
      print1(i, s[i] + 1);
      adjust += k - num[i - 1][s[i] - 'a' + 1];
      num[i - 1][s[i] - 'a' + 1] = add(num[i - 1][s[i] - 'a' + 1]);
      adjust -= k - num[i - 1][s[i] - 'a' + 1];
      print2(i, adjust);
      return;
    }
  }
  cout << "-1" << endl;
}
int main() {
  int t;
  cin >> t;
  for (int i = 1; i <= t; i++) solve();
  return 0;
}
