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() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  int test;
  cin >> test;
  while (test--) {
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    int arr[26];
    memset(arr, 0, sizeof(arr));
    if (n % k != 0) {
      cout << -1 << "\n";
      continue;
    }
    for (int i = 0; i < n; i++) {
      arr[s[i] - 'a']++;
    }
    int i;
    for (i = 0; i < 26; i++) {
      if (arr[i] % k != 0) break;
    }
    if (i == 26) {
      cout << s << "\n";
      continue;
    }
    int mx = -1;
    memset(arr, 0, sizeof(arr));
    for (int i = 0; i < n; i++) {
      if (s[i] == 'z')
        continue;
      else {
        int j = s[i] - 'a';
        j++;
        arr[j]++;
        int need = 0;
        for (int t = 0; t < 26; t++) {
          need += (arr[t] % k);
        }
        int h = n - 1 - i - need;
        if (need <= (n - 1 - i) && h % k == 0) {
          mx = max(mx, i);
        }
        arr[j]--;
        arr[j - 1]++;
      }
    }
    memset(arr, 0, sizeof(arr));
    if (mx != -1) {
      for (int i = 0; i < mx; i++) {
        arr[s[i] - 'a']++;
      }
      string str = s.substr(0, mx);
      int l = s[mx] - 'a';
      l++;
      char c = 'a' + l;
      str += c;
      arr[c - 'a']++;
      int need = 0;
      for (int t = 0; t < 26; t++) {
        need += (arr[t] % k);
      }
      int h = n - 1 - mx - need;
      for (int i = 0; i < h; i++) str += 'a';
      for (int i = 0; i < 26; i++) {
        need = arr[i] % k;
        for (int j = 0; j < need; j++) {
          char c = i + 'a';
          str += c;
        }
      }
      cout << str << "\n";
    } else
      cout << -1 << "\n";
  }
}
