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 t;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    string str;
    cin >> str;
    int min_required = 0;
    vector<int> map(26, 0);
    for (int i = 0; i < n; i++) {
      map[str[i] - 'a']++;
    }
    for (int i = 0; i < 26; i++) {
      if (map[i]) {
        min_required += map[i] % k ? k - map[i] % k : 0;
      }
    }
    bool ans = false;
    if (min_required == 0) {
      ans = true;
    }
    int remspace = 0;
    for (int i = n - 1; i >= 0 && !ans; i--) {
      for (int j = int(str[i]); j <= 122; j++) {
        min_required -= map[str[i] - 'a'] % k ? k - (map[str[i] - 'a'] % k) : 0;
        map[str[i] - 'a']--;
        min_required += map[str[i] - 'a'] % k ? k - (map[str[i] - 'a'] % k) : 0;
        if (j + 1 <= 122) {
          str[i] = char(j + 1);
          min_required -=
              map[str[i] - 'a'] % k ? k - (map[str[i] - 'a'] % k) : 0;
          map[str[i] - 'a']++;
          min_required +=
              map[str[i] - 'a'] % k ? k - (map[str[i] - 'a'] % k) : 0;
          if (remspace - min_required >= 0 &&
              (remspace - min_required) % k == 0) {
            ans = true;
            break;
          }
        }
      }
      if (!ans) {
        str.pop_back();
      }
      remspace++;
    }
    if (!ans) {
      cout << "-1" << endl;
    } else {
      for (int i = 0; i < 26; i++) {
        if (map[i]) {
          int req = map[i] % k ? k - (map[i] % k) : 0;
          while (req--) {
            str.push_back(char(i + 97));
          }
        }
      }
      while (str.size() < n) {
        str.push_back('b');
      }
      cout << str << endl;
    }
  }
}
