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 maxn = 200010;
int vis[27];
int main() {
  int t;
  cin >> t;
  while (t--) {
    int k, n;
    cin >> n >> k;
    string s;
    cin >> s;
    if (n % k != 0) {
      cout << "-1\n";
      continue;
    }
    for (int i = 0; i < 26; i++) vis[i] = 0;
    int sum1 = 0, i = 0, pos = 0, flagg = 0;
    for (; i < n; i++) {
      if (!vis[s[i] - 'a']) sum1++;
      if (sum1 == n / k) pos = i;
      if (sum1 > n / k) {
        flagg = 1;
        break;
      }
      vis[s[i] - 'a'] = (vis[s[i] - 'a'] + 1) % k;
    }
    int flag = 0;
    for (int j = 0; j < 26; j++) {
      if (vis[j] && (j + 'a') > s[i]) {
        flag = 1;
        break;
      }
    }
    if (flag == 0 && flagg != 0) {
      vis[s[pos] - 'a'] = 0;
      s[pos] = s[pos] + 1;
      i = pos + 1;
      vis[s[pos] - 'a']++;
    }
    char p[26];
    int po = 0, ppo = 0;
    for (int j = 0; j < 26; j++) {
      if (vis[j] > 0) p[po++] = j + 'a';
    }
    for (; i < n; i++) {
      if (ppo < po) {
        s[i] = p[ppo];
        vis[p[ppo] - 'a'] = (vis[p[ppo] - 'a'] + 1) % k;
        if (!vis[p[ppo] - 'a']) ppo++;
      } else
        s[i] = 'a';
    }
    cout << s << endl;
  }
  return 0;
}
