1493_C. K-beautiful Strings
You are given a string s consisting of lowercase English letters and a number k. Let's call a string consisting of lowercase English letters beautiful if the number of occurrences of each letter in that string is divisible by k. You are asked to find the lexicographically smallest beautiful string of length n, which is lexicographically greater or equal to string s. If such a string does not exist, output -1.

A string a is lexicographically smaller than a string b if and only if one of the following holds: 

  * a is a prefix of b, but a ≠ b; 
  * in the first position where a and b differ, the string a has a letter that appears earlier in the alphabet than the corresponding letter in b. 

Input

The first line contains a single integer T (1 ≤ T ≤ 10 000) — the number of test cases.

The next 2 ⋅ T lines contain the description of test cases. The description of each test case consists of two lines.

The first line of the description contains two integers n and k (1 ≤ k ≤ n ≤ 10^5) — the length of string s and number k respectively.

The second line contains string s consisting of lowercase English letters.

It is guaranteed that the sum of n over all test cases does not exceed 10^5.

Output

For each test case output in a separate line lexicographically smallest beautiful string of length n, which is greater or equal to string s, or -1 if such a string does not exist.

Example

Input


4
4 2
abcd
3 1
abc
4 3
aaaa
9 3
abaabaaaa


Output


acac
abc
-1
abaabaaab

Note

In the first test case "acac" is greater than or equal to s, and each letter appears 2 or 0 times in it, so it is beautiful.

In the second test case each letter appears 0 or 1 times in s, so s itself is the answer.

We can show that there is no suitable string in the third test case.

In the fourth test case each letter appears 0, 3, or 6 times in "abaabaaab". All these integers are divisible by 3.
```python
#!/usr/bin/python

import sys
from sys import stdin
    
def solve(N, K, S):
    if N % K != 0:
        print(-1)
        return
    cnt_dict = {}
    for s in S:
        cnt_dict[s] = 0
    for s in S:
        cnt_dict[s] += 1
    bea = True
    for k in cnt_dict:
        if cnt_dict[k] % K != 0:
            bea = False
    if bea:
        print(S)
        return
    #string wasnt beautiful but can be made one
    pref = S[:]
    to_add_dict = {}
    for k in cnt_dict:
        to_add_dict[k] = (K - (cnt_dict[k] % K)) % K
    for i in range(1,N+1):
        pref = pref[:-1]
        letter_cur = S[N-i]
        letter_next = chr(ord(letter_cur)+ 1)
        cnt_dict[letter_cur] -= 1
        to_add_dict[letter_cur] += 1
        to_add_dict[letter_cur] %= K
        #check if we can make string beautiful
        my_sum = sum(to_add_dict.values())
        if letter_cur != "z":
            if my_sum < i:
                diff = i - my_sum
                if letter_next in to_add_dict.keys():
                    if to_add_dict[letter_next] == 0:
                        to_add_dict[letter_next] = K
                        diff -= K
                    if 'a' in to_add_dict.keys():
                        to_add_dict['a'] += diff
                    else:
                        to_add_dict['a'] = diff
                    my_suffix = letter_next
                    to_add_dict[letter_next] -= 1
                    for my_key in sorted(to_add_dict):
                        my_suffix += my_key * to_add_dict[my_key]
                else:
                    to_add_dict[letter_next] = K
                    diff -= K
                    if 'a' in to_add_dict.keys():
                        to_add_dict['a'] += diff
                    else:
                        to_add_dict['a'] = diff
                    my_suffix = letter_next
                    to_add_dict[letter_next] -= 1
                    for my_key in sorted(to_add_dict):
                        my_suffix += my_key * to_add_dict[my_key]
                print(pref + my_suffix)
                return
            elif my_sum == i:
                good = False
                for my_key in sorted(to_add_dict):
                    if my_key > letter_cur and to_add_dict[my_key] > 0:
                        my_suffix = my_key
                        to_add_dict[my_key] -= 1
                        good = True
                        break
                if good:
                    for my_key in sorted(to_add_dict):
                        my_suffix += my_key * to_add_dict[my_key]
                    print(pref + my_suffix)
                    return
    return
     
    
    
def run():
    out = ""    
    T = int(input())
    for i in range(T):
        N, K = [int(x) for x in stdin.readline().split()]
        S = stdin.readline().strip()
        solve(N, K, S)

run()


```