View problem - Kirameki of Revue (KAISTRUN26SPRING_E)

Time limitMemory limit# of submissions# of submitted usersSolved #Accepted user ratio
3000 ms1024 MiB1955100.00%

KAIST Music Academy is a prestigious institution with a 100-year history, established to nurture the talents who will carry the future of the theatrical world. There are $N$ stage girls enrolled at the academy, and the $i$-th stage girl possesses a brilliance of $A_i$. Currently, an audition is underway to select the lead role for the play "RUN."

In this audition, to verify each other's skills, every possible pair of stage girls performs a "Revue" exactly once. In each Revue, an amount of brilliance equal to the XOR (exclusive OR) of the two girls' brilliance values is generated.

Giraffe, the organizer of the audition, has become curious about the brilliance value of the $K$-th Revue when the brilliance values of all Revues are sorted in non-decreasing order. For Giraffe, who is struggling with the calculation, let's find this value instead!

Constraints

  • $2 \leq N \leq 100 , 000$
  • $1 \leq K \leq \frac{N \times (N - 1)}{2}$
  • For all $i$ such that $1 \leq i \leq N$, $0 \leq A_i \leq 10^{9}$.

Subtasks

  1. (5 points) $N \leq 2 , 000$
  2. (20 points) $K = 1$
  3. (35 points) $A_i \leq 2^{10} (1 \leq i \leq N)$
  4. (40 points) No additional constraints.

Input Format

The first line contains two space-separated integers $N$ and $K$.

The second line contains $N$ space-separated integers $A_1, A_2, \cdots, A_{N-1}, A_N$.

Output Format

On the first line, print the brilliance value of the $K$-th Revue when the brilliance values of all Revues are sorted in non-decreasing order.

Examples

Example 1

Input

7 15
71 40 45 77 47 66 42

Output

104