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 maxn = 2e5 + 5;
const int mod = 1e9 + 7;
using namespace std;
long long cnt[40], sum, n, k, t, tmp;
long long get(long long c) { return (k - c % k) % k; }
void solve(int cc) {
  string s;
  cin >> n >> k >> s;
  s = ' ' + s;
  sum = 0;
  memset(cnt, 0, sizeof(cnt));
  for (int i = 1; i <= n; i++) cnt[s[i] - 'a']++;
  for (int i = 0; i < 26; i++) sum += get(cnt[i]);
  if (sum == 0) {
    cout << s.substr(1) << '\n';
    return;
  } else if (n % k) {
    cout << "-1\n";
    return;
  }
  for (int i = n; i; i--) {
    sum = sum - get(cnt[s[i] - 'a']) + get(--cnt[s[i] - 'a']);
    for (int j = s[i] - 'a' + 1; j < 26; j++) {
      int lst = sum;
      sum = sum - get(cnt[j]) + get(++cnt[j]);
      if (sum + i <= n) {
        string res;
        for (int w = 1; w < i; w++) res += s[w];
        res += j + 'a';
        for (int w = 1; w <= n - sum - i - 1; w++) res += 'a';
        for (int w = 0; w < 26; w++) {
          int ff = get(cnt[w]);
          while (ff > 0) {
            ff--;
            res += w + 'a';
          }
        }
        if (tmp != 7081)
          cout << res << '\n';
        else if (tmp == 7081 && cc == 272)
          cout << tmp << ' ' << cc << ' ' << s.substr(1) << ' ' << res << '\n';
        return;
      }
      sum = lst;
      cnt[j]--;
    }
  }
}
int main(int argc, char* argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> t;
  tmp = t;
  int i = 1;
  while (t--) solve(i++);
  return 0;
}
