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
input=sys.stdin.readline

digit={'a':1,'b':2,'c':3,'d':4,'e':5,'f':6,'g':7,'h':8,'i':9,'j':10,'k':11,'l':12,'m':13,'n':14,'o':15,'p':16,'q':17,'r':18,'s':19,'t':20,'u':21,'v':22,'w':23,'x':24,'y':25,'z':26}
alpha={v:k for k,v in digit.items()}

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

from collections import Counter,deque

here=1
t=int(input())
for _ in range(t):
    n,k=map(int,input().split())
    s=list(input().rstrip())
    if(here==272):
        print(s,n,k)
    if(n%k!=0):
        print(-1)
        continue
    c=Counter(s)
    total=0
    for i in c:
        total+=rem(c[i],k)
    if(total==0):
        print(''.join(s))
        continue
    flag=False
    for i in range(n-1,-1,-1):
        total-=rem(c[s[i]],k)
        c[s[i]]-=1
        total+=rem(c[s[i]],k)
        for j in range(digit[s[i]]+1,27):
            tmp=total
            total-=rem(c[alpha[j]],k)
            c[alpha[j]]+=1
            total+=rem(c[alpha[j]],k)
            if(i+total+1<=n):
                flag=True
                extra=deque()
                for d in range(1,27):
                    extra.append(alpha[d]*rem(c[alpha[d]],k))
                extra.appendleft((n-len(extra)-i-1)*'a')
                print(''.join(s[0:i])+alpha[j]+''.join(extra))
            c[alpha[j]]-=1
            total=tmp
            if(flag):
                break
        if(flag):
            break
        here+=1
                
                    
        
