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

import sys


def input():
    return sys.stdin.readline().rstrip()


"""
Do not get stuck on a problem for more than 20 minutes
Just check the editorial :)
There should be something else to do insead
"""
SIZE = 26


def tostr(x):
    return chr(x + ord("a"))


def slv():
    n, k = map(int, input().split())
    S = list(map(lambda x: ord(x) - ord("a"), list(input())))
    #trivial case
    if n % k != 0:
        print(-1)
        return

    c = [0]*(SIZE)
    for i in range(n):
        c[S[i]] = c[S[i]] + 1

    for i in range(n, -1, -1):
        left = n - i
        if i == n:
            if all(c[char] % k == 0 for char in range(SIZE)):
                print("".join(map(tostr, S)))
                return
            continue
        

        now_char = S[i]
        c[now_char] -= 1

        minimum_need = [0]*(SIZE)
        for s in range(SIZE):
            if c[s] % k == 0:
                minimum_need[s] = 0
            else:
                minimum_need[s] = k - c[s] % k


        if now_char == SIZE - 1:
            continue

        if all(minimum_need[s] == 0 for s in range(now_char + 1, SIZE)):
            minimum_need[now_char + 1] += k

        if minimum_need[now_char + 1] == 0 and left >= sum(minimum_need) + k:
            minimum_need[now_char + 1] += k



        if left >= sum(minimum_need):
            ans = []
            for j in range(i):
                ans.append(S[j])
    
            for j in range(now_char + 1, SIZE):
                if minimum_need[j] > 0:
                    ans.append(j)
                    minimum_need[j] -= 1
                    break
            q = []
            for j in range(SIZE):
                for _ in range(minimum_need[j]):
                    q.append(j)
            for _ in range(n - len(ans) - len(q)):
                q.append(0)
            q.sort()
            ans += q

            print("".join(map(tostr, ans)))
            return

    return


def main():
    t = int(input())
    for i in range(t):
        slv()
    return


if __name__ == "__main__":
    main()
