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 threading
import sys

threading.stack_size(16*2048*2048)
sys.setrecursionlimit(100010)


def getnext(index,fre,k,s,flag):
    if sum(fre)>len(s)-index:
        return "ERROR"


#    print(index,fre,pre,flag)
    if index==len(s): return ""
    cur = ord(s[index])-97

    if not flag:
        nexts = ""
        spare = (len(s)-index-sum(fre))
        if spare%k==0:
            nexts += 'a'*(spare//k*k)
        for j in range(26):
            if fre[j]>0:  nexts += chr(j+97)*fre[j]
        return nexts

        
                    



    nexts = "ERROR"
    for j in range(cur,26):
        if j>cur and flag: flag = False
        fre[j] -= 1
        if fre[j]<0: fre[j]+=k
        temp = getnext(index+1,fre,k,s,flag)
        if temp!="ERROR": 
            nexts = chr(j+97)+temp
            return nexts
        fre[j] += 1
        if fre[j]==k:  fre[j] = 0


   #print(index,fre,nexts)
            
           
    return nexts




def main():

    T = int(raw_input())
    t = 1

    while t<=T:
        n,k = map(int,raw_input().split())
        s = raw_input()

        

        if n%k>0:
            print -1
            t += 1
            continue

        fre = [0]*26
        ans = getnext(0,fre,k,s,True)

        print ans
        t += 1



threading.Thread(target=main).start()








       







