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

# ------------------- fast io --------------------
import os
import sys
from io import BytesIO, IOBase

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# ------------------- fast io --------------------
from math import gcd, ceil

def prod(a, mod=10**9+7):
    ans = 1
    for each in a:
        ans = (ans * each) % mod
    return ans

def lcm(a, b): return a * b // gcd(a, b)

def binary(x, length=16):
    y = bin(x)[2:]
    return y if len(y) >= length else "0" * (length - len(y)) + y

def beautiful(s):
    c = [0]*26
    for i in s:
        c[i] += 1
        c[i] %= k
    return sum(c) == 0
anss=[]
ooo = []
for _ in range(int(input()) if True else 1):
    #n = int(input())
    n, k = map(int, input().split())
    #a, b = map(int, input().split())
    #c, d = map(int, input().split())
    #a = list(map(int, input().split()))
    #b = list(map(int, input().split()))
    s = [ord(x)-97 for x in input()]

    #n, k = 10, 5
    #from random import randint
    #s = [randint(0,25) for i in range(n)]
    if beautiful(s):
        anss.append([chr(97 + i) for i in s])
        continue
    if n % k:
        anss.append(["-1"])
        continue
    count = [[0]*26]
    used = [0]
    for i in range(n):
        cnt = list(count[-1])
        cnt[s[i]] += 1
        used += [used[-1]]
        if cnt[s[i]] == 1:
            used[-1] += 1
        count += [cnt]
    pos = -1
    for i in range(n):
        extra = 0
        for j in range(26):
            extra += ((k - count[i][j]) % k)
        if n-i >= extra and s[i] != 25:
            rem = n-i - extra
            #print(i ,rem)
            if rem:
                pos = i
            else:
                allowed = False
                for kk in range(s[i]+1, 26):
                    if count[i][kk]:
                        cnc = list(count[i])
                        cnc[kk] += 1
                        extra = 0
                        for j in range(26):
                            extra += ((k - cnc[j]) % k)
                        if n-i >= extra:
                            allowed =True
                if allowed:pos =i
    s2 = []
    s3 = []
    extra = 0
    for j in range(26):
        extra += ((k - count[pos][j]) % k)
    for i in range(pos):
        s2 += [s[i]]
    rem = n-pos - extra
    #print(rem, pos, extra)
    if not rem:
        for kk in range(s[pos] + 1, 26):
            if count[pos][kk] % k:
                s2 += [kk]
                count[pos][kk] += 1
                break
        #print(s2)
    else:
        count[pos][s[pos]+1] += 1
        s2 += [s[pos]+1]
    for j in range(26):
        s3 += [j]*((k - count[pos][j]) % k)
    s2 += [0]*(n - len(s2+s3))
    s2 += s3
    try:
        assert len(s2) == n and beautiful(s2)
    except:
        print(n, k)
        print(*[chr(97 + k) for k in s], sep='')
        quit()
    anss += [[chr(97+k) for k in s2]]


for x in anss:
    print(*x, sep='')


