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

for _ in range(int(input())):
  n,k = map(int,input().split())
  s = list(input())
  if len(s)%k !=0:
    print(-1)
    continue
  
  count = [0]*26
  for e in s:
    i = ord(e)-97
    count[i] += 1
  isBeuty = True
  for i in range(26):
    if count[i]%k!=0:
      isBeuty = False
  if isBeuty:
    print(''.join(s))
    continue
  
  room = 0
  flag = False
  while s:
    cur = s.pop()
    icur = ord(cur)-97
    count[icur]-=1
    room+=1
    if cur == 'z':
      continue
    need = 0
    mx = -1
    for i in range(26):
      if count[i]%k!=0:
        need += k-(count[i]%k)
        if mx == -1 and i>icur:
          mx=i
    if need ==0:
      s.append(cur)
      flag = True
      break
    if need > room:
      continue
    elif need==room:
      if icur > mx:
        continue
      else:
        s.append(chr(mx+97))
        count[mx]+=1
        flag = True
        break
    else:
      s.append(chr(icur+1+97))
      count[icur+1]+=1
      flag = True
      break
  
  if not flag:
    print(-1)
    continue
  
  rem = []
  for i in range(26):
    r = count[i]%k
    if r!=0:
      rem += [chr(97+i)]*(k-r)
  
  result = s + ['a']*(n-len(s)-len(rem)) + rem
  print(''.join(result))