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 int w = 26;
int n, m, k;
string second;
int a[w], b[w];
bool sol(int x) {
  if (x == w || n % k || m >= n) return 0;
  int y = m, z = -1;
  for (int i = 0; i < w; i++) y += (k - a[i] % k) % k;
  if (!x && m == y && y == n) {
    cout << second << '\n';
    return 1;
  }
  if (y + k > n)
    for (int i = x; i < w; i++)
      if (a[i] % k) z = i;
  y += k * !~z;
  if (y > n) return 0;
  if (!~z)
    a[x]++, second += (char)('a' + x);
  else
    a[z]++, second += (char)('a' + z);
  second += string(n - y, 'a');
  for (int i = 0; i < w; i++) {
    second += string((k - a[i] % k) % k, 'a' + i);
  }
  cout << second << '\n';
  return 1;
}
void answer() {
  cin >> n >> k >> second;
  m = second.size();
  memset(a, 0, sizeof(a));
  for (char i : second) a[i - 'a']++;
  if (sol(0)) return;
  while (!second.empty()) {
    int x = second.back() - 'a';
    a[x]--, m--;
    second.pop_back();
    if (sol(x + (m != n - 1))) return;
  }
  cout << -1 << '\n';
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) answer();
  return 0;
}
