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 INF = 1e15;
vector<long long> mem;
long long k;
bool ok(long long lf, string& s) {
  vector<long long> nw(26, 0);
  for (long long i = 0; i < lf; ++i) {
    nw[mem[i]]++;
    s += ('a' + mem[i]);
  }
  long long sm = lf;
  for (long long i = 0; i < 26; ++i) {
    nw[i] = (k - nw[i] % k) % k;
    sm += nw[i];
  }
  long long n = mem.size();
  if (sm > n) {
    return false;
  }
  if (lf < n) {
    if (nw[mem[lf]]) {
      return true;
    }
    if (mem[lf] >= 25) {
      if (sm + k > n) {
        return false;
      }
      return true;
    }
    if (nw[mem[lf] + 1]) {
      nw[mem[lf] + 1]--;
      s += ('a' + mem[lf] + 1);
    } else {
      if (sm + k <= n) {
        s += ('a' + mem[lf] + 1);
        nw[mem[lf] + 1] += k - 1;
        sm += k;
      } else {
        bool oke = false;
        for (long long j = mem[lf] + 1; j < 26; ++j) {
          if (nw[j]) {
            nw[j]--;
            s += ('a' + j);
            oke = true;
            break;
          }
        }
        if (!oke) {
          return false;
        }
      }
    }
  }
  nw[0] += n - sm;
  for (long long i = 0; i < 26; i++) {
    while (nw[i]) {
      nw[i]--;
      s += ('a' + i);
    }
  }
  return true;
}
void solve() {
  long long n;
  cin >> n >> k;
  mem.clear();
  for (long long i = 0; i < n; ++i) {
    char c;
    cin >> c;
    mem.push_back(c - 'a');
  }
  if (n % k != 0) {
    cout << "-1\n";
    return;
  }
  string s = "";
  long long L = mem.size() + 1;
  while (s.size() != mem.size()) {
    --L;
    s = "";
    while (!ok(L, s)) {
      --L;
      s = "";
    }
  }
  cout << s << "\n";
}
int32_t main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0),
      cout << fixed << setprecision(20);
  long long t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
