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>
int fr[26];
int main() {
  int T;
  std::cin >> T;
  while (T--) {
    int N, K;
    std::string str;
    std::cin >> N >> K >> str;
    if (N % K != 0)
      std::cout << "-1\n";
    else {
      for (int i = 0; i < 26; ++i) fr[i] = 0;
      for (int i = 0; i < N; ++i)
        fr[str[i] - 'a'] = (fr[str[i] - 'a'] + K - 1) % K;
      bool ok = true;
      for (int i = 0; i < 26; ++i)
        if (fr[i] % K != 0) ok = false;
      if (ok) {
        std::cout << str << "\n";
      } else {
        int i = N - 1;
        ok = false;
        while (i >= 0 && !ok) {
          fr[str[i] - 'a'] = (fr[str[i] - 'a'] + 1) % K;
          if (str[i] != 'z') {
            int rem = 0;
            for (int t = 0; t < 26; ++t) rem += fr[t];
            if (i + rem <= N) {
              int greater_letter = str[i] - 'a' + 1;
              while (greater_letter < 26 && fr[greater_letter] == 0)
                ++greater_letter;
              if (i + rem + K <= N && greater_letter == 26) {
                fr[str[i] - 'a' + 1] += K;
                greater_letter = str[i] - 'a' + 1;
                rem += K;
              } else if (greater_letter == 26)
                rem += K;
              if (i + rem <= N) {
                fr[0] += N - (i + rem);
                ok = true;
                str[i] = greater_letter + 'a';
                fr[greater_letter]--;
                int j = 0;
                for (int t = i + 1; t < N; ++t) {
                  while (fr[j] == 0) ++j;
                  str[t] = j + 'a';
                  fr[j]--;
                }
              } else
                ok = false;
            } else {
              ok = false;
            }
          }
          i -= (!ok);
        }
        std::cout << str << "\n";
      }
    }
  }
  return 0;
}
