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>
void read(T &x) {
  x = 0;
  int f = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    f |= (ch == '-');
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  x = f ? -x : x;
  return;
}
int h[26];
string s;
int n, k;
int check(int x) {
  if (s[x] == 'z') return false;
  for (int i = 0; i <= 25; i++) {
    h[i] = 0;
  }
  for (int i = 0; i <= x - 1; i++) {
    h[s[i] - 'a']++;
  }
  int sum = s.length() - x;
  for (int i = 0; i <= 25; i++) {
    if (h[i] % k) {
      sum -= k - h[i] % k;
    }
  }
  if (sum > 0) return 2;
  if (sum == 0) {
    for (int i = s[x] - 'a' + 1; i <= 25; i++) {
      if (h[i] % k) return 1;
    }
    return 0;
  }
  return 0;
}
void solve() {
  read(n);
  read(k);
  cin >> s;
  while (s.length() < n) {
    s += "a";
  }
  if (s.length() > n) {
    s = s.substr(0, n);
    s[s.length() - 1]++;
    for (int i = s.length() - 1; i >= 1; i--) {
      if (s[i] - 'a' == 26) {
        s[i - 1]++;
        s[i] = 'a';
      }
    }
    if (s[0] - 'a' == 26) {
      puts("-1");
      return;
    }
  }
  if (n % k) {
    puts("-1");
    return;
  }
  for (int i = 0; i <= 25; i++) h[i] = 0;
  for (int i = 0; i < s.length(); i++) {
    h[s[i] - 'a']++;
  }
  bool flag = true;
  for (int i = 0; i <= 25; i++) {
    if (h[i] % k) flag = false;
  }
  if (flag) {
    cout << s << endl;
    return;
  }
  vector<int> vec;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] != 'z') vec.push_back(i);
  }
  int l = 0, r = vec.size() - 1;
  while (l < r) {
    int mid = (l + r + 1) / 2;
    if (check(vec[mid]))
      l = mid;
    else
      r = mid - 1;
  }
  l = vec[l];
  for (int i = 0; i <= 25; i++) h[i] = 0;
  for (int i = 0; i < l; i++) {
    h[s[i] - 'a']++;
  }
  if (check(l) == 2) {
    s[l] = (char)(s[l] + 1);
    h[s[l] - 'a']++;
  } else {
    for (int i = s[l] - 'a' + 1; i <= 25; i++) {
      if (h[i] % k) {
        s[l] = (char)('a' + i);
        h[i]++;
        break;
      }
    }
  }
  for (int i = n - 1; i > l; i--) {
    bool flag = true;
    for (int j = 25; j >= 0; j--) {
      if (h[j] % k) {
        s[i] = (char)('a' + j);
        h[j]++;
        flag = false;
        break;
      }
    }
    if (flag) {
      s[i] = 'a';
      h[0]++;
    }
  }
  cout << s << endl;
}
int main() {
  int T;
  read(T);
  while (T--) {
    solve();
  }
  return 0;
}
