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 dx[] = {0, 1, 0, -1};
const long long dy[] = {1, 0, -1, 0};
const long long inf = 2e9;
const long long mod = 1e9 + 7;
const long long N = 2e6 + 11;
const long long INF64 = 3e18 + 1;
const double eps = 1e-14;
const double PI = acos(-1);
long long n, k;
char a[N];
void solve() {
  cin >> n >> k;
  string s = "";
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
    s += a[i];
  }
  if (n % k) {
    cout << "-1" << '\n';
    return;
  }
  if (k == 1) {
    cout << s << '\n';
    return;
  }
  map<char, long long> M;
  long long ans = -1;
  char C = 'z';
  for (long long i = 1; i <= n; i++) {
    char ch = a[i];
    ch++;
    for (char c = ch; c <= 'z'; c++) {
      long long x = 0;
      map<char, long long> v = M;
      v[c]++;
      for (auto it : v) {
        if (it.second % k == 0) continue;
        x += k - (it.second % k);
      }
      if ((n - i - x) % k == 0 && (n - i) >= x) ans = i;
    }
    M[a[i]]++;
  }
  long long bl = 1;
  for (auto it : M) {
    if (it.second % k) bl = 0;
  }
  if (bl) {
    cout << s << '\n';
    return;
  }
  if (s[0] == 'z') {
    cout << "-1" << '\n';
    return;
  }
  M.clear();
  for (long long i = 1; i < ans; i++) M[a[i]]++;
  char ch = a[ans];
  ch++;
  for (char c = ch; c <= 'z'; c++) {
    long long x = 0;
    map<char, long long> v = M;
    v[c]++;
    for (auto it : v) {
      if (it.second % k == 0) continue;
      x += k - (it.second % k);
    }
    if ((n - ans - x) % k == 0 && (n - ans) >= x) {
      string second = "";
      for (auto it : v) {
        if (it.second % k == 0) continue;
        for (long long i = 1; i <= k - (it.second % k); i++) second += it.first;
      }
      for (long long i = 1; i < ans; i++) cout << a[i];
      cout << c;
      for (long long i = 1; i <= (n - ans - x); i++) cout << 'a';
      cout << second << '\n';
      return;
    }
  }
}
int32_t main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long T = 1;
  cin >> T;
  while (T--) {
    solve();
  }
}
