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

from string import lowercase as l
from collections import defaultdict
def solve():
    n, k = map(int, raw_input().split())
    s = raw_input().strip()
    if n % k:
        print -1
        return
    d = defaultdict(int)
    for c in s:
        d[c] += 1
    f = 0
    for c, v in d.viewitems():
        if v % k:
            f += k - v % k
    if not f:
        print s
        return
    for i in xrange(n - 1, -1, -1):
        c = s[i]
        p = d[c]
        if p % k:
            f -= k - p % k
        p -= 1
        if p % k:
            f += k - p % k
        d[c] = p
        if n - i >= f:
            x = ord(c) - ord('a') + 1
            for j in xrange(x, 26):
                if d[l[j]] % k or n - i - 1 >= f + k - 1:
                    break
            else:
                continue
            x = l[j]
            s = s[:i] + x
            if d[x] % k:
                f -= k - d[x] % k
            d[x] += 1
            if d[x] % k:
                f += k - d[x] % k
            i += 1
            y = ''
            for c, v in d.viewitems():
                if v % k:
                    y += c * (k - v % k)
            if len(y) < n - i:
                y += 'a' * (n - i - len(y))
            y = ''.join(sorted(list(y)))
            s += y
            print s
            return
T = int(raw_input())
for t in xrange(T):
    solve()
