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;
const long long mod = 1e9 + 7;
const long double eps = 1e-9;
const long long maxn = 1e5 + 1;
const long long inf = 1e15;
const long long minf = -inf;
long long n, k;
bool solve() {
  cin >> n >> k;
  string s;
  cin >> s;
  if (n % k != 0) return false;
  vector<long long> cnt(26, 0);
  vector<vector<long long>> need(n + 1, vector<long long>(26, 0));
  for (long long i = 0; i < n; ++i) {
    if (i) need[i + 1] = need[i];
    cnt[s[i] - 'a']++;
    need[i + 1][s[i] - 'a'] = (k - cnt[s[i] - 'a'] % k) % k;
  }
  if (count(need[n].begin(), need[n].end(), 0) == 26) {
    cout << s << "\n";
    return true;
  }
  for (long long i = n - 1; i >= 0; --i) {
    long long space = n - 1 - i;
    cnt[s[i] - 'a']--;
    for (char x = s[i] + 1; x <= 'z'; ++x) {
      s[i] = x;
      cnt[x - 'a']++;
      need[i][x - 'a'] = (k - cnt[x - 'a'] % k) % k;
      long long here = 0;
      for (long long ptr = 0; ptr < 26; ++ptr) here += need[i][ptr];
      if (here > space) {
        cnt[x - 'a']--;
        continue;
      }
      long long extra = space - here;
      if (extra % k != 0) {
        cnt[x - 'a']--;
        continue;
      }
      need[i + 1][0] += extra;
      for (long long ptr = 0; ptr <= i; ++ptr) cout << s[ptr];
      for (long long ptr = 0; ptr < 26; ++ptr) {
        while (need[i][ptr]--) cout << (char)('a' + ptr);
      }
      cout << "\n";
      return true;
    }
  }
  return true;
}
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  cin >> t;
  while (t--) {
    if (solve()) {
    } else {
      cout << -1 << "\n";
    }
  }
  return 0;
}
