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;
template <typename T>
using min_heap = priority_queue<T, vector<T>, greater<T>>;
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
  for (auto& v : vec) is >> v;
  return is;
}
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  os << "[ ";
  for (int i = 0; i < v.size(); ++i) {
    os << v[i];
    if (i != v.size() - 1) os << ", ";
  }
  os << " ]\n";
  return os;
}
template <typename T>
ostream& operator<<(ostream& os, const set<T>& v) {
  os << "[ ";
  for (auto it : v) {
    os << it;
    if (it != *v.rbegin()) os << ", ";
  }
  os << " ]\n";
  return os;
}
template <typename T>
ostream& operator<<(ostream& os, const multiset<T>& v) {
  os << "[ ";
  for (auto it : v) os << it << ", ";
  os << " ]\n";
  return os;
}
template <typename T, typename S>
ostream& operator<<(ostream& os, const map<T, S>& v) {
  os << "{ ";
  for (auto it : v) os << it.first << " : " << it.second << ", ";
  os << " }\n";
  return os;
}
template <typename T, typename S>
ostream& operator<<(ostream& os, const pair<T, S>& v) {
  os << "(";
  os << v.first << ", " << v.second << ")";
  return os;
}
template <typename T>
ostream& operator<<(ostream& os, priority_queue<T> p) {
  os << "[ ";
  while (!p.empty()) {
    os << p.top() << " ,";
    p.pop();
  }
  os << " ]\n";
  return os;
}
inline long long pmod(long long i, long long n) { return (i % n + n) % n; }
const long long INF = 1e18;
const long long mod = 1e9 + 7;
vector<long long> cnt;
long long get(long long x, long long k) { return (k - x % k) % k; }
void solve() {
  long long n, k;
  cin >> n >> k;
  cnt.assign(26, 0);
  string s;
  cin >> s;
  for (auto(c) : (s)) ++cnt[c - 'a'];
  if (n % k != 0) {
    cout << -1;
    return;
  }
  long long sum = 0;
  for (auto(e) : (cnt)) sum += get(e, k);
  if (sum == 0) {
    cout << s;
    return;
  }
  for (long long(i) = (n - 1); (i) >= (0); --(i)) {
    sum -= get(cnt[s[i] - 'a'], k);
    --cnt[s[i] - 'a'];
    sum += get(cnt[s[i] - 'a'], k);
    long long lst = sum;
    for (long long(j) = (s[i] - 'a' + 1); (j) <= (26); ++(j)) {
      sum -= get(cnt[j], k);
      ++cnt[j];
      sum += get(cnt[j], k);
      if (sum + i + 1 <= n) {
        cout << s.substr(0, i) << char(j + 'a');
        string add = "";
        for (long long(kk) = (0); (kk) <= (26); ++(kk)) {
          long long ck = get(cnt[kk], k);
          for (long long(kkk) = (1); (kkk) <= (ck); ++(kkk))
            add += char(kk + 'a');
        }
        while ((long long)(add).size() + i + 1 < n) add += 'a';
        sort((add).begin(), (add).end());
        if ((long long)(add).size()) cout << add;
        return;
      }
      sum = lst;
      --cnt[j];
    }
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int t = 1;
  cin >> t;
  for (int t1 = 1; t1 <= t; ++t1) {
    solve();
    cout << '\n';
  }
}
