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 long long MOD = 1e9 + 7;
const long long N = 5e5 + 10;
void test_case() {
  long long n, k;
  string s;
  cin >> n >> k >> s;
  vector<long long> tot(26, 0);
  for (int i = 0; i < n; i++) {
    tot[s[i] - 'a']++;
  }
  if (n % k != 0) {
    cout << -1 << '\n';
    return;
  }
  for (int i = n - 1; i >= 0; i--) {
    if (i < n - 1) tot[s[i + 1] - 'a']--;
    string temp = s;
    vector<long long> req(26, 0);
    long long tt = 0;
    for (int j = 0; j < 26; j++) {
      req[j] = k - tot[j] % k;
      if (req[j] == k) req[j] = 0;
      tt += req[j];
    }
    long long left = n - i - 1;
    if (left < tt || (left - tt) % k != 0) continue;
    if (left == 0 && tt == 0) {
      cout << temp << '\n';
      return;
    }
    if (i == n - 1) continue;
    if (s[i + 1] == 'z') continue;
    if (req[s[i + 1] - 'a' + 1] != 0) {
      temp[i + 1] = s[i + 1] + 1;
      req[s[i + 1] - 'a' + 1]--;
    } else if (left > tt) {
      temp[i + 1] = s[i + 1] + 1;
      req[s[i + 1] - 'a' + 1] = k - 1;
    } else {
      bool flag = 0;
      for (int j = int(s[i + 1] - 'a' + 1); j < 26; j++) {
        if (req[j]) {
          flag = 1;
          req[j]--;
          temp[i + 1] = 'a' + j;
          break;
        }
      }
      if (!flag) continue;
    }
    long long curr = i + 2;
    for (int j = 0; j < 26; j++) {
      for (int k = 0; k < req[j]; k++) {
        temp[curr++] = 'a' + j;
      }
    }
    cout << temp << '\n';
    return;
  }
  cout << -1 << '\n';
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int tc = 1;
  cin >> tc;
  while (tc--) test_case();
  return 0;
}
