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 T, n, k;
char s[100010];
int t[26];
int js(int x) { return (k - x) % k; }
int main() {
  scanf("%d", &T);
  while (T--) {
    scanf("%d%d", &n, &k);
    scanf("%s", s + 1);
    memset(t, 0, sizeof(t));
    if (n % k) {
      printf("-1\n");
      continue;
    }
    for (int i = 1; i <= n; i++) t[s[i] - 'a']++;
    bool bz = 1;
    int sum = 0;
    for (int i = 0; i < 26; i++) {
      t[i] %= k;
      if (t[i]) bz = 0;
      sum += (k - t[i]) % k;
    }
    if (bz) {
      for (int i = 1; i <= n; i++) printf("%c", s[i]);
      printf("\n");
      continue;
    }
    for (int i = n; i; i--) {
      sum -= js(t[s[i] - 'a']);
      t[s[i] - 'a']--;
      if (t[s[i] - 'a'] < 0) t[s[i] - 'a'] += k;
      sum += js(t[s[i] - 'a']);
      for (int j = s[i] - 'a' + 1; j < 26; j++) {
        sum -= js(t[j]);
        t[j]++;
        if (t[j] == k) t[j] = 0;
        sum += js(t[j]);
        if (sum <= n - i) {
          for (int l = 1; l < i; l++) printf("%c", s[l]);
          printf("%c", j + 'a');
          for (int l = 1; l <= sum - n + i; l++) printf("a");
          int ls = 0, r = 0;
          for (int l = 1; l <= sum; l++) {
            while (js(t[r]) + ls < l) ls += t[r], r++;
            printf("%c", r + 'a');
          }
          printf("\n");
          bz = 1;
          break;
        }
        sum -= js(t[j]);
        t[j]--;
        if (t[j] < 0) t[j] += k;
        sum += js(t[j]);
      }
      if (bz) break;
    }
  }
  return 0;
}
