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 collections import deque, defaultdict
from math import sqrt, ceil, factorial, floor, inf, log2
import bisect
import sys
import copy


def get_array(): return list(map(int, sys.stdin.readline().strip().split()))


def get_ints(): return map(int, sys.stdin.readline().strip().split())


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


stri = 'abcdefghijklmnopqrstuvwxyz'
di=dict()
for i in range(len(stri)):
    di[stri[i]]=i

for _ in range(int(input())):
    n, l = get_ints()
    s = input()
    arr = [[0 for i in range(26)] for j in range(n)]
    arr[0][di[s[0]]] = 1
    flag = 0
    for i in range(1, n):
        arr[i][di[s[i]]] += 1
        for j in range(26):
            arr[i][j] += arr[i - 1][j]
    flag3 = 0
    for i in range(26):
        if arr[n - 1][i] % l != 0:
            flag3 = 1
    if flag3 == 0:
        print(s)
    else:
        for i in range(n - 1, -1, -1):
            flag = 0
            for j in range(di[s[i]]+ 1, 26):
                indi=max(i-1,0)
                d = [0] * 26
                cnt = 0
                rems = n - (i + 1)
                for k in range(26):
                    element=arr[indi][k]
                    if k==j:
                        element+=1
                    if element % l != 0:
                        req = ceil(element/ l) * l
                        addi = req - element
                        d[k] = addi
                        cnt += addi
                if cnt <= rems and (rems - cnt) % l == 0:
                    ind = i
                    ele = j
                    d[0] += rems - cnt
                    flag = 1
                if flag == 1:
                    break
            if flag == 1:
                break

        if flag == 1:
            st = ""
            for i in range(ind):
                st += s[i]
            st += stri[ele]
            for i in range(26):
                st += stri[i] * d[i]

            print(st)
        else:
            print(-1)