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

from math import ceil

def check(store,n,k):
    add=0
    for i in range(26):
        add+=ceil(store[i]/k)
    if(add*k<=n):
        return 1
    return 0


for _ in range(int(input())):
    n,k=map(int,input().split())
    st=input()
    ans=[]
    for i in range(n):
        ans.append(st[i])
    store=[0 for i in range(26)]
    count=0
    for i in st:
        store[ord(i)-97]+=1
        if(store[ord(i)-97]%k==1):
            count+=1
    if(n%k>0):
        print(-1)
        continue
    flag=1
    for i in range(26):
        if(store[i]%k>0):
            flag=-1
            break
    if(flag==1):
        print(st)
        continue
    i=0
    for i in range(n-1,-1,-1):
        if(st[i]!="z"):
            store[ord(st[i])-97]-=1
            store[ord(st[i])-96]+=1
            if(check(store,n,k)):
                break
            store[ord(st[i])-96]-=1
        else:
            store[ord(st[i])-97]-=1
        ans[i]=0
    ans[i]=chr(ord(st[i])+1)
    rang=n-1
    for j in range(25,-1,-1):
        for l in range((k-store[j]%k)%k):
            ans[rang]=chr(j+97)
            rang-=1
    for i in ans:
        if(i==0):
            print("a",end='')
        else:
            print(i,end='')
    print()