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 + 10;
char q[N];
int next[N], f[N];
int main() {
  int t;
  cin >> t;
  while (t--) {
    memset(f, 0, sizeof f);
    bool st = true;
    int n, k;
    cin >> n >> k;
    cin >> q;
    if (n % k != 0)
      cout << "-1" << endl;
    else {
      bool flag = false;
      for (int i = 0; i < n; i++) {
        if (flag) {
          for (int j = 0; j <= 25; j++) {
            if (f[j] % k != 0) {
              q[i] = j + 'a';
              f[j]++;
              break;
            }
          }
          continue;
        }
        int t = q[i] - 'a';
        f[t]++;
        int cnt = 0;
        for (int j = 0; j <= 25; j++) {
          cnt += ((k - f[j]) % k + k) % k;
        }
        if ((n - i - 1) < cnt) {
          f[t]--;
          for (int j = 0; j <= 25; j++) {
            if (f[j] % k != 0 && j > t) {
              q[i] = j + 'a';
              f[j]++;
              flag = true;
              break;
            }
          }
        } else if (n - i - 1 == cnt) {
          int cns = 0;
          int p = q[i + 1] - 'a';
          bool st = false;
          for (int j = 0; j <= 25; j++) {
            if (f[j] % k != 0 && j > p) st = true;
            if (j == p)
              cns += ((k - f[j] - 1) % k + k) % k;
            else
              cns += ((k - f[j]) % k + k) % k;
          }
          if (cns > n - i - 2 && !st) {
            f[t]--;
            q[i] = q[i] + 1;
            int p = q[i] - 'a';
            f[p]++;
            flag = true;
          }
        }
      }
      for (int i = 0; i < n; i++) cout << q[i];
      cout << endl;
    }
  }
}
