object Main extends App {
  import scala.io.StdIn._
  val Array(n, k) = readLine.trim.split(' ').map(_.toLong)
  val numbers = 0 +: readLine.trim.split(' ').map(_.toInt)//numbers(i) == [0, i)の排他的論理和
  for (i ← numbers.indices.tail) numbers(i) ^= numbers(i - 1)
  var rest = k
  var result = 0
  val maxDigit = 20
  val count = Array.tabulate(1 << maxDigit){_ ⇒ 0}
  for (topDigit ← 1 to maxDigit){
    val next = result * 2 + 1
    var sum = 0L
    for (num ← numbers){
      count(num >> (maxDigit - topDigit)) += 1
      sum += count((num >> (maxDigit - topDigit)) ^ next)
    }
    if (sum >= rest){
      result = result * 2 + 1
    }else {
      result = result * 2
      rest -= sum
    }
    (0 until (1 << topDigit)).foreach(i ⇒ count(i) = 0)
  }
  println(result)
  implicit class Scope[T](val value: T) extends AnyVal {
    @inline
    def also(@inline func: T ⇒ Unit): T = {
      func(value)
      value
    }
    @inline
    def let[A](@inline func: T ⇒ A): A = func(value)
  }
}
