#include <iostream>
using namespace std;

long long N, K, A[1 << 18], dp[1 << 22];
long long pos[1 << 18];

void add(int pos) {
	pos += (1 << 20);
	while (pos >= 1) {
		dp[pos]++;
		pos >>= 1;
	}
}

int main() {
	cin >> N >> K;
	for (int i = 1; i <= N; i++) cin >> A[i];
	for (int i = 1; i <= N; i++) A[i] ^= A[i - 1];
	for (int i = 1; i <= N; i++) pos[i] = 1;

	long long sum = 0, ans = 0;
	for (int i = 19; i >= 0; i--) {
		for (int j = 0; j < (1 << 21); j++) dp[j] = 0;

		add(0); long long prelim = sum;
		for (int j = 1; j <= N; j++) {
			if ((A[j] / (1LL << i)) % 2 == 0) { prelim += dp[pos[j] * 2 + 1]; }
			else { prelim += dp[pos[j] * 2]; }
			add(A[j]);
		}

		if (prelim < K) {
			// 答えは一定以下
			sum = prelim;
			for (int j = 1; j <= N; j++) {
				if ((A[j] / (1LL << i)) % 2 == 0) { pos[j] = pos[j] * 2; }
				else { pos[j] = pos[j] * 2 + 1; }
			}
		}
		else {
			// 答えは一定以上
			ans += (1 << i);
			for (int j = 1; j <= N; j++) {
				if ((A[j] / (1LL << i)) % 2 == 0) { pos[j] = pos[j] * 2 + 1; }
				else { pos[j] = pos[j] * 2; }
			}
		}
	}

	cout << ans << endl;
	return 0;
}
