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 total_testcases;
  cin >> total_testcases;
  for (int testcase = 0; testcase < total_testcases; testcase++) {
    int n, k;
    char bsf = 'a';
    cin >> n >> k;
    string s;
    cin >> s;
    if (n % k != 0) {
      cout << "-1" << endl;
    } else {
      string ans = s;
      vector<int> req(26, 0);
      int totReq = 0;
      for (int i = 0; i < n; i++) {
        char c = s[i];
        if (bsf < c) {
          bsf = c;
        }
        if (req[c - 'a'] > 0) {
          totReq--;
          req[c - 'a']--;
        } else {
          if ((totReq + k - 1) == (n - i) - 1) {
            bool found = false;
            for (int j = i + 1; j < n; j++) {
              if (s[j] > bsf) {
                found = true;
                break;
              }
            }
            if (found) {
              if (req[(c - 'a') + 1] > 0) {
                ans[i] = c + 1;
                req[(c - 'a') + 1]--;
                totReq--;
                i++;
                while (i < n - totReq) {
                  ans[i] = 'a';
                  i++;
                }
                for (int j = 0; j < 26; j++) {
                  while (req[j] > 0) {
                    ans[i] = 'a' + j;
                    i++;
                    req[j]--;
                    totReq--;
                  }
                }
                i = n;
              } else {
                ans[i] = c + 1;
                req[(c - 'a') + 1] = k - 1;
                totReq += k - 1;
                i++;
                for (int j = 0; j < 26; j++) {
                  while (req[j] > 0) {
                    ans[i] = 'a' + j;
                    i++;
                    req[j]--;
                    totReq--;
                  }
                }
                i = n;
              }
            } else {
              req[c - 'a'] = k - 1;
              totReq += k - 1;
            }
          } else if ((totReq + k - 1) < (n - i) - 1) {
            req[c - 'a'] = k - 1;
            totReq += k - 1;
          } else {
            for (int j = 0; j < 26; j++) {
              if (req[j] > 0) {
                c = 'a' + j;
                ans[i] = c;
                req[c - 'a']--;
                totReq--;
                break;
              }
            }
          }
        }
      }
      cout << ans << endl;
    }
  }
  return 0;
}
