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>
const int N = 1e6 + 10;
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;
using namespace std;
int cnt[30], k, n;
long long sum = 0;
int getsum() {
  int ss = 0;
  for (int i = 0; i <= 25; i++) ss += (k - cnt[i] % k) % k;
  return ss;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    memset(cnt, 0, sizeof cnt);
    cin >> n >> k;
    string s;
    cin >> s;
    for (int i = 0; i < s.length(); i++) cnt[s[i] - 'a']++;
    sum = getsum();
    if (sum == 0)
      cout << s << endl;
    else if (n % k != 0)
      cout << "-1" << endl;
    else {
      bool is_continue = true;
      for (int i = n - 1; i >= 0; i--) {
        cnt[s[i] - 'a']--;
        sum = getsum();
        if (sum > (n - i)) continue;
        for (int j = 1; s[i] + j <= 'z'; j++) {
          char c = char(j + s[i]);
          cnt[c - 'a']++;
          sum = getsum();
          if (sum > (n - i) - 1) {
            cnt[c - 'a']--;
            continue;
          }
          s[i] = c;
          is_continue = false;
          int flag = i;
          for (int k = 1; k <= n - (flag + 1) - sum; k++) s[++i] = 'a';
          char st = 0;
          for (int v = 1; v <= sum; v++) {
            while ((k - (cnt[st] % k)) % k == 0 && st <= 25) {
              st++;
            }
            s[++i] = char(st + 'a');
            cnt[st]--;
          }
          if (!is_continue) break;
        }
        if (!is_continue) break;
      }
      cout << s << endl;
    }
  }
  return 0;
}
