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 collections import Counter
 
def calc_req(val, k):
    return (k-(val%k))%k
 
t = int(input())
for _ in range(t):
    n, k = map(int, input().split())
    s = input()
    if (t==7081):
        if (_==127 or _==128 or _==129):
            print(n, k, s)
        continue
    if n%k:
        print(-1)
    else:
        d = dict(Counter(s))
        for i in range(ord("a"), ord("z")+1):
            if chr(i) not in d: d[chr(i)] = 0
        req = 0
        maxS = max(s)
        for v in d.values():
            req += calc_req(v, k)
        if req==0:
            print(s)
        else:
            for i in range(n-1, -1, -1):
                req -= calc_req(d[s[i]], k)
                req += calc_req(d[s[i]]-1, k)
                d[s[i]] -= 1
                for letter in range(ord(s[i])+1, ord(maxS)+1):
                    letter = chr(letter)
                    req -= calc_req(d[letter], k)
                    req += calc_req(d[letter]+1, k)
                    if req<=n-i-1:
                        cons = s[:i]+letter+("a"*(n-i-1-req))
                        for i in range(ord("a"), ord("z")+1):
                            if chr(i)==letter:
                                cons += chr(i)*(calc_req(d[chr(i)]+1, k))
                            else:
                                cons += chr(i)*(calc_req(d[chr(i)], k))
                        print(cons)
                        break
                    req -= calc_req(d[letter]+1, k)
                    req += calc_req(d[letter], k)
                else:
                    continue
                break
