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;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    long long n, k;
    cin >> n >> k;
    string st;
    cin >> st;
    if (n % k) {
      cout << -1 << endl;
      continue;
    }
    set<long long> ops;
    vector<vector<long long>> curr(n, vector<long long>(26, 0));
    string ans;
    long long cnt = 0;
    long long idx = -1;
    for (long long i = 0; i < n; i++) {
      long long x = st[i] - 'a';
      if (i) {
        curr[i] = curr[i - 1];
      }
      if (curr[i][x]) {
        curr[i][x]--;
      } else {
        if (cnt < n) {
          ops.insert(i);
          curr[i][x] += k - 1;
          cnt += k;
        } else {
          idx = i;
          break;
        }
      }
    }
    if (idx == -1) {
      cout << st << endl;
      continue;
    }
    long long same_upto = -1, to_fill = -1;
    bool flag = false;
    vector<long long> real_state(26, 0);
    for (long long i = idx; i >= 0 && !flag; i--) {
      long long x = st[i] - 'a';
      if (ops.count(i)) {
        if (x < 25) {
          same_upto = i;
          to_fill = x + 1;
          if (i) {
            real_state = curr[i - 1];
          }
          real_state[to_fill] += k;
          flag = true;
          continue;
        } else {
          cnt -= k;
          continue;
        }
      }
      for (long long j = x + 1; j < 26; j++) {
        if (curr[i - 1][j]) {
          same_upto = i;
          to_fill = j;
          if (i) {
            real_state = curr[i - 1];
          }
          flag = true;
          break;
        }
      }
      if (flag) {
        break;
      }
    }
    if (cnt < n) {
      real_state[0] += (n - cnt);
    }
    for (long long i = 0; i < same_upto; i++) {
      ans += st[i];
    }
    ans += char(to_fill + 97);
    real_state[to_fill]--;
    for (long long i = 0; i < 26; i++) {
      for (long long j = 0; j < real_state[i]; j++) {
        ans += char(97 + i);
      }
    }
    cout << ans << endl;
  }
}
