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

# cook your dish here
def check_str(s,k):
    d={}
    for ch in s:
        if ch in d:
            d[ch]+=1
        else:
            d[ch]=1
    cnt=0
    for ch in d:
        if d[ch]%k!=0:
            cnt=1
            break
    if(cnt==1):
        return False
    else:
        return True
        
def inc_lex(s):
    val = len(s)
    val_d = val+0
    val -= 1    #to match last index
    while(val>=0 and s[val]=='z'):
        s[val] = 'a'    #since we have to move to next character
        val-=1
    if(val<0):
        return [7] #to print -1
    else:
        s[val] = chr(ord(s[val])+1)
        return s
        


t = int(input())

for i in range(t):
    n,k = map(int,input().split())
    s = input()
    s = list(s)
    d = {'a': 0, 'b': 0, 'c': 0, 'd': 0, 'e': 0, 'f': 0, 'g': 0, 'h': 0, 'i': 0, 'j': 0, 'k': 0, 'l': 0, 'm': 0, 'n': 0, 'o': 0, 'p': 0, 'q': 0, 'r': 0, 's': 0, 't': 0, 'u': 0, 'v': 0, 'w': 0, 'x': 0, 'y': 0, 'z': 0}
    d1 = d.copy()
    if(n%k!=0):
        print(-1)
    else:
        #for checking if the string is beautiful
        for ch in s:
            d[ch]+=1
        cnt=0
        overall_req = 0
        for ch in d:
            if(d[ch]%k!=0):
                overall_req += k-d[ch]%k
                d1[ch] = k-d[ch]%k
        for ch in d:
            if(d[ch]%k!=0):
                cnt=1
                break
        #print(d)
        if(cnt==0):
            print("".join(s))
        else:
            for j in range(n-1,-1,-1):
                #print("hurray")
                val = s[j]
                if((d[val]-1)%k==0):
                    overall_req-=d1[val]
                    #print("op",overall_req)
                    d1[val] = 0
                else:
                    d1[val]+=1
                    overall_req+=1
                d[val]-=1
                qnt=0
                for q in range(ord(val)+1,123):
                    #qnt=0
                    #d1 = {}
                    req_posn = 0
                    #d[val]-=1
                    d[chr(q)]+=1
                    if(d1[chr(q)]==0):
                        d1[chr(q)]+=k-1
                        overall_req+=k-1
                    else:
                        d1[chr(q)]-=1
                        overall_req-=1
                    #print(chr(q),overall_req)
                    '''for ch in d:
                        if(d[ch]%k!=0):
                            req_posn += k-d[ch]%k
                            d1[ch] = k-d[ch]%k'''
                    if(overall_req>n-j-1):
                        #d[val]+=1
                        if((d[chr(q)]-1)%k==0):
                            overall_req-=d1[chr(q)]
                            d1[chr(q)] = 0
                        else:
                            d1[chr(q)]+=1
                            overall_req+=1
                        d[chr(q)]-=1
                        continue
                    else:
                        if((n-j-1-overall_req)%k==0):
                            #print("found")
                            kuch = []
                            for ch in d1:
                                kuch.extend([ch]*d1[ch])
                            luch = ['a']*(n-j-1-overall_req)
                            luch.extend(kuch)
                            s = s[:j]
                            #print(s,j)
                            s.append(chr(q))
                            s.extend(luch)
                            print("".join(s))
                            qnt=1
                            break
                        else:
                            #d[val]+=1
                            if((d[chr(q)]-1)%k==0):
                                overall_req-=d1[chr(q)]
                                d1[chr(q)] = 0
                            else:
                                d1[chr(q)]+=1
                                overall_req+=1
                            d[chr(q)]-=1
                            continue
                if(qnt==1):
                    break
                #print("jai ho")