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;
int prefix[30];
void solve() {
  long long n, m, k;
  cin >> n >> k;
  string s;
  cin >> s;
  if (n % k != 0) {
    cout << -1 << '\n';
    return;
  }
  for (int i = 0; i < n; i++) prefix[s[i] - 'a']++;
  bool ok = 1;
  for (int i = 0; i < 26; i++)
    if (prefix[i] % k != 0) ok = 0;
  if (ok) {
    cout << s << '\n';
    return;
  }
  int pos = -1;
  string res;
  for (int i = n - 1; i >= 0; i--) {
    prefix[s[i] - 'a']--;
    if (s[i] == 'z') continue;
    bool ok2 = 0;
    for (char c = s[i] + 1; c <= 'z'; c++) {
      prefix[c - 'a']++;
      int sum = 0;
      for (int j = 0; j < 26; j++) sum += (k - prefix[j] % k) % k;
      if (sum > n - 1 - i) {
        prefix[c - 'a']--;
        continue;
      } else {
        pos = i;
        ok2 = 1;
        s[i] = c;
        break;
      }
    }
    if (ok2) break;
  }
  for (int i = 0; i <= pos; i++) cout << s[i];
  for (int i = 0; i < 26; i++) {
    for (int j = 0; j < (k - prefix[i] % k) % k; j++) cout << (char)(i + 'a');
  }
  cout << '\n';
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
    for (int i = 0; i < 26; i++) prefix[i] = 0;
  }
  return 0;
}
