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

"""
#If FastIO not needed, use this and don't forget to strip
#import sys, math
#input = sys.stdin.readline
"""

import os, sys, heapq as h, time
from io import BytesIO, IOBase
from types import GeneratorType
from bisect import bisect_left, bisect_right
from collections import defaultdict as dd, deque as dq, Counter as dc
import math, string
BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0
    def __init__(self, file):
        import os
        self.os = os
        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 = self.os.read(self._fd, max(self.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 = self.os.read(self._fd, max(self.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:
            self.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")

#start_time = time.time()

def getInt(): return int(input())
def getStrs(): return input().split()
def getInts(): return list(map(int,input().split()))
def getStr(): return input()
def listStr(): return list(input())
def getMat(n): return [getInts() for _ in range(n)]
def isInt(s): return '0' <= s[0] <= '9'

MOD = 10**9 + 7 

"""
Note that 'zzzzzzz' satisfies any requirements where N % K = 0
In fact, repeating the first letter after our first letter that many times will suffice
What is the latest place we can allow the string to differ?
Possible up to the point we're at if sum((-count[letter])%K) for all letters is <= remaining letters, and there exists a letter in the set that is
>= the next letter
"""


def solve():
    N, K = getInts()
    S = listStr()
    if N % K != 0: return -1
    counts = [0]*26
    ord_a = ord('a')
    for a in S:
        counts[ord(a) - ord_a] += 1
        counts[ord(a) - ord_a] %= K
    t = S[:]
    curr = 0
    for j in range(26):
        curr += (-counts[j])%K
    rem = 0
    #print(curr,counts)
    flag = False
    if curr == 0: return ''.join(S)
    while curr > rem or not flag:
        x = t.pop()
        ord_x = ord(x)-ord_a
        curr -= (-counts[ord_x])%K
        counts[ord_x] -= 1
        counts[ord_x] %= K
        curr += (-counts[ord_x])%K
        flag = False
        for j in range(ord_x+1,26):
            tmp_curr = curr
            tmp_curr -= (-counts[j])%K
            tmp_curr += ((-counts[j]-1)%K)
            if tmp_curr <= rem:
                flag = True
                break
        if flag:
            t.append(chr(ord_a+j))
            counts[j] += 1
            counts[j] %= K
            break
        rem += 1
    tmp_ans = []
    #print(t)
    for j in range(25,-1,-1):
        tmp_ans += [chr(j+ord_a)]*(-counts[j]%K)
    tmp_ans.reverse()
    t += (N-len(tmp_ans)-len(t))*['a']
    return ''.join(t+tmp_ans)
    
for _ in range(getInt()):
    print(solve())
#solve()

#print(time.time()-start_time)