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

#######################################################################################################################
#   Author:     BlackFyre
#   Language:   PyPy 3.7
#######################################################################################################################
 
from sys import stdin, stdout, setrecursionlimit
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log, log2
from random import seed, randint
from datetime import datetime
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
from collections import defaultdict as dd
mod = pow(10, 9) + 7
mod2 = 998244353
# setrecursionlimit(3000)

def inp(): return stdin.readline().strip()
def iinp(): return int(inp())
def out(var, end="\n"): stdout.write(str(var) + "\n")
def outa(*var, end="\n"): stdout.write(' '.join(map(str, var)) + end)
def lmp(): return list(mp())
def mp(): return map(int, inp().split())
def smp(): return map(str, inp().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(m, val) for j in range(n)]
def remadd(x, y): return 1 if x % y else 0
def ceil(a, b): return (a + b - 1) // b
def def_value(): return 0
def def_inf(): return inf
def atoi(s): return ord(s)-ord('a')
def inc(s, n=1): return chr((ord(s)-ord('a')+n)%26+ord('a'))
def chk(a,k):
    flg = True
    for i in range(26):
        if a[i]%k!=0: flg=False
    return flg
    
def need(x,k): return (k - x%k)%k
    
for _ in range(iinp()):
    n,k = mp()
    s = inp()
    if n%k!=0: print(-1)
    else:
        cnt = dd(int)
        for i in s:
            cnt[atoi(i)]+=1
        
        sm = 0
        flg = True
        for i in range(26):
            sm += need(cnt[i],k)
        if sm==0:
            print(s)
            flg = False
        
        for i in range(n-1,-1,-1):
            if not flg: break
            sm -= need(cnt[atoi(s[i])],k)
            cnt[atoi(s[i])]-=1
            sm += need(cnt[atoi(s[i])],k)
            
            for j in range(atoi(s[i])+1, 26):
                tmp = sm
                sm -= need(cnt[j],k)
                cnt[j]+=1
                sm += need(cnt[j],k)
                if i+sm+1<=n:
                    ans = s[:i]+inc('a',j)
                    add = ""
                    for w in range(26):
                        add += inc('a',w)*(need(cnt[w],k))
                    add+= "a"*(n-len(add)-len(ans))
                    ans+=''.join(sorted(add))
                    print(ans)
                    flg = False
                    break
                cnt[j]-=1
                sm = tmp