Substring Xor

4.2

15 votes
Problem

Given a length-n array a and a number k, there are n×(n+1)2 subarrays in total. For each subarray, we can compute the xor sum of its elements.

In this problem, we will sort all these xor-sums in non-increasing order. And we want to find the kth element.

Input

The first line contains two numbers n (1n100000) and k (1kn×(n+1)2).

The second line contains n numbers - a1,a2,a3,,an (0ai<220).

Output

Output the kth element in the non-increasing order.

Time Limit: 2
Memory Limit: 256
Source Limit:
Explanation

All the xors of subarrays are (15,12,11,10,8,7,7,6,5,4,4,3,3,2,1), the 10th is 4.

Editor Image

?