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;
template <class T>
bool ckmin(T& a, const T& b) {
  return b < a ? a = b, 1 : 0;
}
template <class T>
bool ckmax(T& a, const T& b) {
  return a < b ? a = b, 1 : 0;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const long long MOD = 1000000007;
const char nl = '\n';
const long long MX = 100001;
long long powi(long long x, long long n) {
  long long res = 1;
  while (n) {
    if (n & 1) res = (res * x) % MOD;
    x = (x * x) % MOD;
    n >>= 1;
  }
  return res;
}
bool isPowerOfTwo(long long n) {
  if (n == 0) return 0;
  while (n != 1) {
    if (n % 2 != 0) return 0;
    n = n / 2;
  }
  return 1;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  a %= b;
  return gcd(b, a);
}
void solve() {
  long long n;
  cin >> n;
  long long k;
  cin >> k;
  string second;
  cin >> second;
  map<char, long long> help;
  long long blank;
  if (n % k != 0) {
    cout << -1 << "\n";
    return;
  }
  for (long long i = 0; i < (n); i++) {
    help[second[i]]++;
  }
  bool flag = 0;
  for (auto it : help) {
    if ((it.second) % k != 0) flag = 1;
  }
  if (flag == 0) {
    cout << second << "\n";
    return;
  }
  string ans;
  for (long long i = n - 1; i >= 0; i--) {
    if (i == 0) {
      char temp = (long long)second[i];
      help[temp]++;
      help[second[i]]--;
      bool flag2 = 0;
      long long tp = 0;
      for (auto it : help) {
        tp += (k - (it.second) % k) % k;
      }
      if (n - 1 - i >= tp) {
        cout << second.substr(0, i);
        cout << temp;
        blank = n - 1 - i;
        break;
      }
      help[temp]--;
    }
    char temp = (long long)second[i] + 1;
    help[temp]++;
    help[second[i]]--;
    bool flag2 = 0;
    long long tp = 0;
    for (auto it : help) {
      tp += (k - (it.second) % k) % k;
    }
    if (n - 1 - i >= tp) {
      cout << second.substr(0, i);
      cout << temp;
      blank = n - 1 - i;
      break;
    }
    help[temp]--;
  }
  for (auto it = help.rbegin(); it != help.rend(); it++) {
    if ((k - (it->second) % k) % k != 0) {
      long long ti = (k - (it->second) % k) % k;
      while (ti--) {
        ans.push_back(it->first);
        blank--;
      }
    }
  }
  while (blank--) {
    cout << "a";
  }
  reverse(ans.begin(), ans.end());
  cout << ans << "\n";
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  cin >> t;
  while (t--) solve();
  return 0;
}
