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;
using ll = long long;
using vi = vector<int>;
using vl = vector<long long>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
template <class T>
inline bool ckmin(T& a, T b) {
  return b < a ? a = b, 1 : 0;
}
template <class T>
inline bool ckmax(T& a, T b) {
  return b > a ? a = b, 1 : 0;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const char nl = '\n';
const int mxN = 2e5 + 10;
const int MOD = 1e9 + 7;
const long long infLL = 1e18;
void solve() {
  int n, k;
  cin >> n >> k;
  string second;
  cin >> second;
  if (n % k != 0) {
    cout << "-1\n";
    return;
  }
  int mx = n / k;
  int lo = 0, hi = n - 1;
  string ans;
  function<bool(int)> go = [&](int pos) -> bool {
    ans.clear();
    if (pos < n && second[pos] == 'z') return go(pos + 1);
    map<char, int> cnt;
    for (char e1 = 'a'; e1 <= 'z'; e1++) cnt[e1] = 0;
    for (int i = (0); i < (pos); i++) {
      cnt[second[i]] = (cnt[second[i]] + 1) % k;
      ans += second[i];
    }
    string bruh = ans;
    if (pos == n) {
      for (auto& x : cnt) {
        if (x.second != 0) return 0;
      }
      return 1;
    }
    map<char, int> temp = cnt;
    for (char x = second[pos] + 1; x <= 'z'; x++) {
      cnt = temp;
      ans = bruh;
      ans.push_back(x), cnt[x] = (cnt[x] + 1) % k;
      string tmp;
      for (auto& x : cnt) {
        if (x.second == 0) continue;
        for (int i = (0); i < (k - x.second); i++) {
          tmp += x.first;
        }
      }
      int N = (int)ans.size();
      if (n - N - (int)tmp.size() < 0) continue;
      for (int i = (0); i < (n - N - (int)tmp.size()); i++) ans += 'a';
      ans += tmp;
      return 1;
    }
    return 0;
  };
  if (go(n)) {
    cout << ans << nl;
    return;
  }
  for (lo--; lo < hi;) {
    int mid = lo + (hi - lo + 1) / 2;
    if (go(mid))
      lo = mid;
    else
      hi = mid - 1;
  }
  go(lo);
  cout << ans << nl;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
