XOR#8677

XOR

2 seconds
256 megabytes
Medium

Aftandil has a sequence of integers a_1, a_2, ..., a_n. He decides to divide the sequence into exactly consecutive parts.

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

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

Input

The first line contains two integers and (1 \le n \le 200{\,}000, 1 \le m \le n).

The second line contains integers a_1, a_2, ..., a_n (0 \le a_i \le 10^9).

Output

Print a single integer that denotes the minimum cost.

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading