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 __future__ import print_function,division
# range = xrange
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10**9)
from sys import stdin, stdout
from collections import defaultdict, Counter
M = 10**9+7

def main():
    d = {chr(i+ord('a')):i for i in range(26)}
    for _ in range(int(input())):
        n,k = [int(s) for s in input().split()]
        s = input().strip()
        if n%k!=0:
            print(-1)
            continue
        pre = [[0 for i in range(26)] for j in range(n+1)]
        for i in range(n):
            for j in range(26):
                pre[i][j] = pre[i-1][j]
            pre[i][d[s[i]]]+=1
        for j in range(26):
            if pre[n-1][j]%k!=0:
                break
        else:
            print(s)
            continue
        for i in range(n-1,-1,-1):
            req = {}
            sumr = 0
            for j in range(26):
                if pre[i-1][j]%k!=0:
                    req[chr(j+ord('a'))] = k-(pre[i-1][j]%k)
                    sumr += (k-(pre[i-1][j]%k))
            if sumr<=n-i and s[i]!='z':
                if (n-i-sumr)%k==0:
                    ans = s[:i]
                    flag = 0
                    if n-i-sumr>0:
                        if chr(ord(s[i])+1) in req:
                            req[chr(ord(s[i])+1)] -=1
                        else:
                            req[chr(ord(s[i])+1)] = k-1
                            sumr+=k
                        ans+=chr(ord(s[i])+1)
                        flag = 1
                    req1 = sorted([[c,req[c]] for c in req])
                    if not flag:
                        for w in range(len(req1)):
                            if req1[w][0]>s[i]:
                                ans += req1[w][0]
                                req1[w][1]-=1
                                flag = 1
                                break
                    if not flag:
                        continue
                    ans+="a"*(n-i-sumr)
                    for w in range(len(req1)):
                        ans+=req1[w][0]*req1[w][1]
                    print(ans)
                    break
        else:
            print(-1)

            



if __name__== '__main__':
    main()