P26503 [AtCoder] Iroha and Problem
NOI
题目描述

Problem Description

Iroha was given the following problem by Takahashi:

  • A sequence of non-negative integers $A_1,\ A_2,\ \dots,\ A_N$ is given.
  • For all pairs of integers $(l,\ r)$ satisfying $1\ \leq\ l\ \leq\ r\ \leq\ N$, compute $ A_l $ xor ... xor $ A_r $ and write it on the blackboard.
  • Arrange the $ N(N+1)/2 $ integers written on the blackboard in descending order and find the $ K $-th largest number.

Iroha has already solved this problem at "AtCoder Koshien". When she told Takahashi about this, he said, "The xor was actually a typo for or". Regardless of the truth of this statement, please solve the problem again by replacing xor with or.

Input Format

The input is given from the standard input in the following format:

$ N $ $ K $ $ A_1 $ $ A_2 $ $\vdots$ $ A_N $

Output Format

Output the answer to the problem given by Takahashi, with xor replaced by or, in one line.

Sample Input and Output

Sample Input #1

3 3
4
3
5

Sample Output #1

7

Sample Input #2

3 6
1
3
4

Sample Output #2

1

Sample Input #3

9 37
2
0
1
2
5
7
0
2
3

Sample Output #3

2

Sample Input #4

17 100
3
14
15
92
65
35
89
79
32
38
46
26
43
38
32
79
50

Sample Output #4

111

Notes/Hints

Constraints

  • $1\ \leq\ N\ \leq\ 10^5$
  • $1\ \leq\ K\ \leq\ N(N+1)/2$
  • $0\ \leq\ A_i\ <\ 2^{60}$
  • $ N, K, A_i $ are integers
输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 3 4 3 5
样例输出
7