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;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int MOD = 1e9 + 7, MAX = 1e6 + 5;
const long long INF = 1e18 + 5;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    if (n % k)
      cout << -1 << endl;
    else {
      vector<int> H(26);
      for (int i = 0; i < n; i++) {
        H[s[i] - 'a']++;
      }
      bool div = true;
      for (int j = 0; j < 26; j++)
        if (H[j] % k) div = false;
      if (div) {
        cout << s << endl;
        continue;
      }
      for (int i = n - 1; i >= 0; i--) {
        if (s[i] == 'z') continue;
        vector<int> Rem(26);
        for (int j = 0; j < i; j++) {
          Rem[s[j] - 'a']++;
        }
        int sum = 0;
        for (int j = 0; j < 26; j++) {
          Rem[j] %= k;
          Rem[j] = k - Rem[j];
          Rem[j] %= k;
          sum += Rem[j];
        }
        if (sum > n - i) continue;
        char fc = s[i];
        fc++;
        string ta;
        if (Rem[fc - 'a']) {
          Rem[fc - 'a']--;
          for (int j = 0; j < 26; j++) {
            for (int v = 0; v < Rem[j]; v++) {
              ta += ('a' + j);
            }
          }
          sort(ta.begin(), ta.end());
          for (int j = 0; j < n - i - ta.length() - 1; j++) ta += 'a';
          sort(ta.begin(), ta.end());
          reverse(ta.begin(), ta.end());
          ta += fc;
          reverse(ta.begin(), ta.end());
        } else {
          if (n - i - sum) {
            ta += fc;
            for (int j = 0; j < 26; j++) {
              for (int v = 0; v < Rem[j]; v++) {
                ta += ('a' + j);
              }
            }
            for (int v = 0; v < k - 1; v++) {
              ta += fc;
            }
            for (int j = 0; j < n - i - ta.length(); j++) ta += 'a';
            sort(1 + ta.begin(), ta.end());
          } else {
            continue;
          }
        }
        for (int j = i; j < n; j++) s[j] = ta[j - i];
        cout << s << endl;
        break;
      }
    }
  }
}
