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;
int main() {
  const int n_letters = 26;
  const char first_let = 'a';
  int t, n, k;
  cin >> t;
  string ans[t];
  string s;
  for (int q = 0; q < t; q++) {
    cin >> n;
    cin >> k;
    cin >> s;
    if (n % k != 0) {
      ans[q] = "-1";
      continue;
    }
    vector<int> cont(n_letters, 0);
    int space;
    bool posible;
    int i, let;
    for (i = 0; i < n; i++) {
      if (s[i] != char(first_let + n_letters)) {
        cont[s[i] - first_let]++;
        posible = false;
        for (int j = s[i + 1] - first_let + 1; j < n_letters; j++) {
          cont[j]++;
          space = 0;
          for (int p = 0; p < n_letters; p++) {
            space += (k - cont[p] % k) % k;
          }
          cont[j]--;
          if (space <= n - i - 1) {
            posible = true;
            let = j;
            break;
          }
        }
        if (!posible) break;
      }
    }
    if (i == n) {
      ans[q] = s;
      continue;
    }
    ans[q] = "";
    for (int j = 0; j < i; j++) {
      ans[q] += s[j];
    }
    cont[s[i] - first_let]--;
    cont[let]++;
    ans[q] += char(let + first_let);
    space = 0;
    for (int p = 0; p < n_letters; p++) {
      space += (k - cont[p] % k) % k;
      cont[p] = (k - cont[p] % k) % k;
    }
    for (int p = i + 1; p < n - space; p++) {
      ans[q] += 'a';
    }
    int ind = 0;
    for (int p = n - space; p < n; p++) {
      while (cont[ind] == 0) ind++;
      ans[q] += char(first_let + ind);
      cont[ind]--;
    }
  }
  for (int q = 0; q < t; q++) {
    cout << ans[q] << endl;
  }
  return 0;
}
