object Main {
  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val n = sc.nextInt
    val k = sc.nextLong
    val list = List.fill(n)(sc.nextLong)
    val ans = (0L to k).map(x => func(x,list)).maxBy(_._2)._2
    println(ans)
  }

  def func(x:Long, list:List[Long]) : (Long, Long) = {
    val f:Long = list.map(y => x^y).sum
    (x,f)
  }
}