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 sys
input=sys.stdin.buffer.readline

def solve():
  N,K=map(int,input().split())
  S=list(input())
  for i in range(N):
    S[i]-=97
  if N%K:
    print(-1)
    return 0
  C=[0]*26
  for i in range(N):
    C[S[i]]+=1
  C=[0]*26
  for i in range(N):
    C[S[i]]+=1
    if C[S[i]]==K:
      C[S[i]]=0
  if max(C)==0:
    print(''.join([chr(S[i]+97) for i in range(N)]))
    return 0
  for i in range(N-1,-1,-1):
    C[S[i]]-=1
    for j in range(S[i]+1,26):
      C[j]+=1
      Z=[0]*26
      for k in range(26):
        Z[k]=-C[k]%K
      X=sum(Z)
      if X<=N-i-1:
        ANS=[]
        for k in range(i):
          ANS.append(chr(97+S[k]))
        ANS.append(chr(j+97))
        ANS.append('a'*(N-i-X-1))
        for k in range(26):
          ANS.append(chr(97+k)*Z[k])
        print(''.join(ANS))
        return 0
      C[j]-=1

for t in range(int(input())):
  solve()
