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, math, itertools, random, bisect
from collections import defaultdict
INF = sys.maxsize
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def get_array(): return list(map(int, sys.stdin.readline().strip().split()))
def input(): return sys.stdin.readline().strip()
mod = 10**9 + 7

def get(x,k):
    return (k - x%k) % k

for _ in range(int(input())):
    n,k = get_ints()
    s = input()

    if n%k!=0: print(-1)
    else:
        cnt = [0]*26
        for i in s:
            cnt[ord(i)-ord('a')] += 1
        
        tot = 0
        flag = 1
        for i in range(26):
            tot += get(cnt[i],k)

        if tot==0: 
            print(s)
            flag = 0

        for i in range(n-1,-1,-1):
            if not flag: break
            tot -= get(cnt[ord(s[i])-ord('a')], k)
            cnt[ord(s[i])-ord('a')] -= 1
            tot += get(cnt[ord(s[i])-ord('a')], k)
            for j in range(ord(s[i])-ord('a')+1, 26):
                lst_tot = tot
                tot -= get(cnt[j],k)
                cnt[j] += 1
                tot += get(cnt[j],k)
                if tot <= n-i-1:
                    print(s[:i],end="")
                    print(chr(ord('a')+j),end="")
                    rem = ""
                    for w in range(26):
                        f = get(cnt[w],k)
                        rem += chr(ord('a')+w)*f
                    rem += 'a'*(n-i-1 - len(rem))
                    rem = "".join(sorted(rem))
                    print(rem)
                    flag = 0
                    break
        
                cnt[j] -= 1
                tot = lst_tot