import java.util.Scanner

object Main {
  def main(args:Array[String]) = {
    val sc = new Scanner(System.in)
    val N = sc.nextInt()
    val K = sc.nextLong()
    val listA = List.fill(N)(sc.nextLong())

    if (K == 0L) {
      println(listA.sum)
    } else {
      val r = 0L.until(K).toList.map { X =>
        listA.map(a => X ^ a).sum
      }.sortWith((a, b) => a > b).head
      println(r)
    }
  }
}