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>
#pragma GCC optimize("-Ofast")
std::ifstream ___in("input.in");
using namespace std;
using ll = long long;
static const bool tc = 1;
static const ll mod = LLONG_MAX - 24;
void solve() {
  ll n, k;
  char s[100005], cnt[100005][30];
  cin >> n >> k >> (s + 1);
  if (n % k != 0) {
    cout << -1 << "\n";
    return;
  }
  for (int i = 0; i < 26; ++i) cnt[0][i] = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j < 26; ++j) cnt[i][j] = cnt[i - 1][j];
    ++cnt[i][s[i] - 'a'];
  }
  for (int i = s[n]; i <= 'z'; ++i) {
    ll cnt2[30] = {};
    for (int j = 1; j < n; ++j) ++cnt2[s[j] - 'a'];
    ++cnt2[i - 'a'];
    bool ok = 1;
    for (int j = 0; j < 26 && ok; ++j)
      if (cnt2[j] % k != 0) ok = 0;
    if (ok) {
      s[n] = i;
      cout << (s + 1) << "\n";
      return;
    }
  }
  for (int i = n; i > 1; --i) {
    char c = s[i - 1];
    for (int j = c + 1; j <= 'z'; ++j) {
      s[i - 1] = j;
      int cnt2[30] = {};
      for (int x = 0; x < 26; ++x) cnt2[x] = cnt[i - 2][x];
      ++cnt2[j - 'a'];
      int sum = 0;
      for (int x = 0; x < 26; ++x) sum += (k - cnt2[x] % k) % k;
      int free = n - i + 1;
      if (sum <= free) {
        for (int x = n; x >= i; --x) {
          for (int y = 25; y >= 0; --y) {
            if (cnt2[y] % k != 0) {
              ++cnt2[y];
              s[x] = 'a' + y;
              break;
            } else
              s[x] = 'a';
          }
        }
        cout << (s + 1) << "\n";
        return;
      }
    }
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  srand(time(0));
  int T = 1;
  if (tc) cin >> T;
  for (int i = 1; i <= T; ++i) {
    solve();
  }
  return 0;
}
