eolymp
bolt
Try our new interface for solving problems

XOR

Aftandil has a sequence of integers a1, a2, ... , an. He decides to divide the sequence into exactly m consecutive parts.

The cost of each part is its xor-sum (bitwise exclusive-or), while the cost of the sequence is bitwise or-sum of its parts' costs.

Help Aftandil to find the minimum cost of the given sequence.

Input

The first line contains two integers n and m (1n200000, 1mn).

The second line contains n integers a1, a2, ... , an (0ai109).

Output

Print a single integer that denotes the minimum cost.

Time limit 2 seconds
Memory limit 256 MiB
Input example #1
3 2
1 3 2
Output example #1
1
Input example #2
4 1
1 2 0 2

Output example #2
1
Source IZHO 2019 Selection Contest, Dec. 29 2018, Baku