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 math
from collections import deque
from sys import stdin, stdout, setrecursionlimit
from string import ascii_letters
from decimal import *
letters = ascii_letters[:26]
from collections import defaultdict
#from functools import reduce
#input = stdin.readline
#print = stdout.write

def ceildiv(a, b):
    return a // b + (1 if a % b else 0)

for _ in range(int(input())):
    n, k = map(int, input().split())
    ind = -1
    s = input()
    cnt = defaultdict(int)
    for i in s:
        cnt[i] += 1
    if all([i % k == 0 for i in cnt.values()]):
        print(s)
        continue
    need = defaultdict(int)
    val = -1
    for i in range(n):
        if s[i] == 'z':
            need[s[i]] += 1
            continue
        for v in letters[letters.index(s[i]) + 1:]:
            need[v] += 1
            bf = sum([ceildiv(g, k) * k  for g in need.values()])
            if bf <= n and (n - bf) % k == 0:
                ind = i
                val = v
                need[v] -= 1
                break
            need[v] -= 1
        need[s[i]] += 1

    if ind == -1:
        print(-1)
        continue
    
    cnt = defaultdict(int)
    res = []
    for i in range(ind):
        res.append(s[i])
        cnt[s[i]] += 1

    res.append(val)
    cnt[val] += 1
    other = n - sum([ceildiv(g, k) * k  for g in cnt.values()])
    for i in cnt.keys():
        cnt[i] = cnt[i] % k
    cnt['a'] += other
    for i in sorted(cnt.keys()):
        while cnt[i] > 0:
            cnt[i] -= 1
            res.append(i)        
    print(''.join(res))