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;
string s;
long long a, b, c, e, f, g;
long long h[30];
long long h2[30];
void solve() {
  cin >> a >> b;
  cin >> s;
  string mnt;
  for (long long i = 0; i <= 'z' - 'a'; i++) {
    h[i] = 0;
    h2[i] = 0;
  }
  if (a % b != 0) {
    cout << -1 << '\n';
    return;
  }
  for (long long i = 0; i < s.size(); i++) {
    c = s[i] - 'a';
    h[c]++;
    mnt.push_back('z');
  }
  bool flag = 0;
  for (long long i = 0; i <= 'z' - 'a'; i++) {
    if (h[i] % b != 0) flag = 1;
  }
  if (flag == 0) {
    cout << s << '\n';
    return;
  }
  flag = 0;
  string ans = s;
  long long r = s.size();
  for (long long i = 0; i < s.size(); i++) {
    r--;
    ans.pop_back();
    c = s[r] - 'a';
    h[c]--;
    if (s[r] == 'z') continue;
    f = i + 1;
    for (long long j = 0; j <= 'z' - 'a'; j++) {
      c = h[j] / b;
      if (h[j] % b != 0) c++;
      c = c * b;
      h2[j] = c - h[j];
      f -= h2[j];
    }
    if (f % b != 0 || f < 0) continue;
    if (f == 0) {
      flag = 0;
      c = s[r] - 'a';
      for (long long j = c + 1; j <= 'z' - 'a'; j++) {
        if (h2[j] != 0) {
          h2[j]--;
          char t2;
          t2 = j + 'a';
          ans.push_back(t2);
          flag = 1;
          break;
        }
      }
      if (flag == 0) continue;
      for (long long j = 0; j <= 'z' - 'a'; j++) {
        while (h2[j] != 0) {
          char t2;
          t2 = j + 'a';
          ans.push_back(t2);
          h2[j]--;
        }
      }
      if (ans.size() != s.size())
        while (1 != 0) cout << 1;
      else
        cout << ans << '\n';
      return;
    } else {
      char t2;
      t2 = s[r] + 1;
      ans.push_back(t2);
      c = t2 - 'a';
      h2[c] += (b - 1);
      f -= b;
      while (f != 0) {
        ans.push_back('a');
        f--;
      }
      for (long long j = 0; j <= 'z' - 'a'; j++) {
        while (h2[j] != 0) {
          char t2;
          t2 = j + 'a';
          ans.push_back(t2);
          h2[j]--;
        }
      }
      if (ans.size() != s.size())
        while (1 != 0) cout << 1;
      else
        cout << ans << '\n';
      return;
    }
    r--;
  }
}
int main() {
  long long q;
  q = 1;
  cin >> q;
  while (q != 0) {
    q--;
    solve();
  }
}
