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 int MAX = 1e5, MAX_ALPHAS = 26;
int n, k, occurs[MAX_ALPHAS];
string wrd;
inline bool beautiful(int occr[MAX_ALPHAS]) {
  for (char c : wrd)
    if (occr[c - 'a'] % k) return false;
  return true;
}
inline int last_nonz() {
  int i = 0, res = INT_MAX;
  while (i < n) {
    if (wrd[i] != 'z') res = i;
    i++;
  }
  return res;
}
inline int rem(int x) { return (k - x % k) % k; }
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int tc;
  cin >> tc;
  while (tc--) {
    string res = "-1";
    for (int i = 0; i < MAX_ALPHAS; i++) occurs[i] = 0;
    cin >> n >> k;
    cin >> wrd;
    for (char c : wrd) occurs[c - 'a']++;
    int sum = 0;
    bool flag = true;
    for (int i = 0; i < MAX_ALPHAS; i++) sum += rem(occurs[i]);
    if (!sum)
      cout << wrd << endl;
    else if (n % k)
      cout << res << endl;
    else {
      for (int i = n - 1; i >= 0; i--) {
        const int ci = wrd[i] - 'a';
        sum -= rem(occurs[ci]);
        occurs[ci]--;
        sum += rem(occurs[ci]);
        for (int j = ci + 1; j < MAX_ALPHAS; j++) {
          int tmpsum = sum, oj = occurs[j];
          sum -= rem(oj);
          occurs[j]--;
          sum += rem(oj);
          if (i + sum + 1 <= n) {
            for (int pos = 0; pos < i; pos++) cout << wrd[pos];
            cout << char(j + 'a');
            string add = "";
            for (int w = 0; w < MAX_ALPHAS; w++) {
              int f = rem(occurs[w]);
              while (f) add += char(w + 'a'), f--;
            }
            while ((int)add.size() + i + 1 < n) add += "a";
            sort(add.begin(), add.end());
            cout << add << endl;
            i = -1;
            break;
          }
          occurs[j]--;
          sum = tmpsum;
        }
      }
    }
  }
  return 0;
}
