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;
long long int mod = 1e9 + 7;
long long int m = 998244353;
long long int modularExponentiation(long long int x, long long int n) {
  if (n <= 0)
    return 1;
  else if (n % 2 == 0)
    return modularExponentiation((x * x) % mod, n / 2) % mod;
  else
    return (x * (modularExponentiation((x * x) % mod, n / 2)) % mod) % mod;
}
int a[] = {0, 1, 5, -1, -1, 2, -1, -1, 8, -1};
string sot(int b) {
  string s = "";
  s = char((b / 10) + '0');
  s += char((b % 10) + '0');
  return s;
}
void solvet() {
  int h, m;
  cin >> h >> m;
  string s;
  cin >> s;
  if (a[s[0] - '0'] != -1 && a[s[1] - '0'] != -1) {
    int b = a[s[1] - '0'] * 10 + a[s[0] - '0'];
    if (b < m) {
      int g = ((s[3] - '0') * 10) + (s[4] - '0');
      for (int i = g; i < m; i++) {
        if (a[i / 10] != -1 && a[i % 10] != -1) {
          int k = (a[i % 10] * 10) + a[i / 10];
          if (k < h) {
            cout << s.substr(0, 2) << ":" << sot(i) << endl;
            return;
          }
        }
      }
    }
  }
  int b = (s[0] - '0') * 10 + (s[1] - '0');
  for (int i = b; i < h; i++) {
    if (a[i / 10] != -1 && a[i % 10] != -1) {
      int k = (a[i % 10] * 10) + a[i / 10];
      if (k < m) {
        cout << sot(i) << ":" << sot(0) << endl;
        return;
      }
    }
  }
  cout << "00:00" << endl;
}
void solve() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  if (n % k) {
    cout << -1 << endl;
  } else {
    vector<vector<int>> dp(n, vector<int>(26, 0));
    dp[0][s[0] - 'a'] = 1;
    for (int i = 1; i < n; i++) {
      for (int j = 0; j < 26; j++) {
        dp[i][j] = dp[i - 1][j];
      }
      dp[i][s[i] - 'a']++;
    }
    int f = 0;
    for (int i = 0; i < 26; i++) {
      if (dp[n - 1][i] % k) f++;
    }
    if (f == 0) {
      cout << s << endl;
      return;
    }
    int m = 0;
    for (int i = n - 2; i >= 0; i--) {
      m = 0;
      for (int j = 0; j < 26; j++) {
        m += (k - dp[i][j] % k) % k;
      }
      if (n - i - 1 >= m) {
        int t = -1;
        for (int j = 0; j < 26; j++) {
          if (dp[i][j] % k && j > (s[i + 1] - 'a')) {
            t = j;
            break;
          }
        }
        if (n - i - 1 >= m + k) {
          if (s[i + 1] == 'z') continue;
          t = min(s[i + 1] + 1 - 'a', 25);
        }
        if (t != -1) {
          string ss = "";
          ss = s.substr(0, i + 1);
          ss.push_back(char(t + 'a'));
          dp[i][t]++;
          int l = 0;
          m = 0;
          for (int j = 0; j < 26; j++) {
            m += (k - dp[i][j] % k) % k;
          }
          for (int j = 0; j < n - i - 2 - m; j++) {
            ss.push_back('a');
          }
          while (l < 26) {
            if (dp[i][l] % k) {
              ss.push_back(l + 'a');
              dp[i][l]++;
            } else
              l++;
          }
          cout << ss << endl;
          return;
        }
      }
    }
    for (int i = 0; i < n; i++) {
      cout << char(s[0] + 1);
    }
    cout << 1 << endl;
    cout << endl;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
}
