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() {
  int t, k, n, mk, cnt[26], i, j, minm, r, sum, num;
  string s1, s2;
  cin >> t;
  while (t--) {
    cin >> n >> k;
    cin >> s1;
    s2 = s1;
    if (n % k)
      cout << -1 << endl;
    else {
      memset(cnt, 0, sizeof(cnt));
      sum = 0;
      num = 0;
      for (i = 0; i < n; ++i) {
        r = n - i;
        if (s1[i] != 'z') {
          if (r + sum >= (num + 1) * k)
            mk = i;
          else {
            for (j = s1[i] - 'a' + 1; j < 26; ++j) {
              if (cnt[j] % k) {
                mk = i;
                break;
              }
            }
          }
        }
        ++cnt[s1[i] - 'a'];
        ++sum;
        if (cnt[s1[i] - 'a'] % k == 1) {
          ++num;
        }
        if (cnt[s1[i] - 'a'] % k == 0) {
          sum -= k;
          --num;
        }
      }
      if (!sum) {
        cout << s2 << endl;
      } else {
        memset(cnt, 0, sizeof(cnt));
        sum = 0;
        num = 0;
        for (i = 0; i < mk; ++i) {
          ++cnt[s1[i] - 'a'];
          ++sum;
          if (cnt[s1[i] - 'a'] % k == 1) {
            ++num;
          }
          if (cnt[s1[i] - 'a'] % k == 0) {
            sum -= k;
            --num;
          }
        }
        bool f = true;
        while (cnt[s2[mk] - 'a'] % k == 0) {
          ++s2[mk];
          if (s2[mk] > 'z') {
            s2[mk] = s1[mk] + 1;
            ++cnt[s2[mk] - 'a'];
            f = false;
            break;
          }
        }
        if (f) --cnt[s2[mk] - 'a'];
        j = 0;
        for (i = mk + 1; i < n; ++i) {
          while (cnt[j] % k == 0) ++j;
          if (j >= 26) break;
          s2[i] = 'a' + j;
          --cnt[j];
        }
        for (i; i < n; ++i) {
          s2[i] = 'a';
        }
        cout << s2 << endl;
      }
    }
  }
  return 0;
}
