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

def check(d, k):
    delta = n - sum(d)
    for i in d:
        delta -= (k - i%k)%k
    if delta < 0:
        return False
    else:
        return True
        
def try_(index, d, i):
    for jindex in range(index + 1, len(d)):
        d[jindex] += 1
        if check(d, k):
            s[i] = chr(97 + jindex)
            return True
        else:
            d[jindex] -= 1
    return False
            


for _ in range(int(input())):
    n,k = map(int, input().split())
    s = list(input())

    d = [0 for i in range(26)]
    
    for i in s:
        index = ord(i) - 97
        d[index] += 1
    if n %k != 0:
        print(-1)
        continue

    if check(d,k):
        print(''.join(s))
        continue

    flg = False   
    
    for i in range(len(s)-1, -1, -1):
        index = ord(s[i]) - 97
        d[index] -= 1
        
        if check(d, k):

            if try_(index, d, i):
                flg = True
                
               
                sss = sum(d)
                
                for x in range(len(d)):
                    d[x] = (k - d[x]%k)%k
                    sss += d[x]
                    
                d[0] += n - sss
                x = 0
                i += 1

                while x < len(d):
                    while x < len(d) and d[x] == 0:
                        x += 1
                    if x < len(d):
                        s[i] = chr(x+97)
                        d[x] -= 1
                        
                        i += 1
                break
                
    if flg:
        print(''.join(s))
    else:
        print(-1)
        
    
        
        
