You are given a number with n digits written in base b. For example, our monetary system is written in base 10 (i.e. 926 JOD) and a binary number is written in base 2 (i.e. 10101110).
Your task is to find the next greater number that consists of distinct digits (no digit is repeated twice).
It is *guaranteed* that there is an answer for the given number.
The first line of input contains two integers n and b (1 ≤ n ≤ 3 × 105) (2 ≤ b ≤ 3 × 105), the number of digits of the number and the base it is written in.
The second line of input contains n integers ai (0 ≤ ai < b), where ai is the ith digit in the number. It is *guaranteed* that the number has no leading zeros.
Output a single line with the next greater number that consists of distinct digits. Separate the digits by a single space.
## Input
The first line of input contains two integers n and b (1 ≤ n ≤ 3 × 105) (2 ≤ b ≤ 3 × 105), the number of digits of the number and the base it is written in.The second line of input contains n integers ai (0 ≤ ai < b), where ai is the ith digit in the number. It is *guaranteed* that the number has no leading zeros.
## Output
Output a single line with the next greater number that consists of distinct digits. Separate the digits by a single space.
[samples]
**Definitions**
Let $ n, b \in \mathbb{Z} $ with $ 1 \leq n \leq 3 \times 10^5 $ and $ 2 \leq b \leq 3 \times 10^5 $.
Let $ A = (a_1, a_2, \dots, a_n) $ be a sequence of digits with $ a_i \in \{0, 1, \dots, b-1\} $, $ a_1 \neq 0 $, representing a number in base $ b $.
**Constraints**
1. All digits in $ A $ may not be distinct initially.
2. The number has no leading zeros: $ a_1 \neq 0 $.
3. There exists at least one number greater than $ A $ in base $ b $ with exactly $ n $ digits and all distinct digits.
**Objective**
Find the lexicographically smallest sequence $ B = (b_1, b_2, \dots, b_n) $ such that:
- $ B > A $ (as base-$ b $ numbers),
- $ b_i \in \{0, 1, \dots, b-1\} $ for all $ i $,
- $ b_1 \neq 0 $,
- All digits in $ B $ are distinct: $ b_i \neq b_j $ for $ i \neq j $.
Output $ B $ as $ b_1, b_2, \dots, b_n $ separated by spaces.