open Scanf
open Printf
open Array

let bit k =
  let r = make 40 0 in
  let pw = ref 1 in
  for i=0 to 39 do
    r.(i) <- k land !pw / !pw; pw := !pw * 2
  done; r
let print_iarr a = iter (printf "%d ") a; print_newline ()

let () = scanf " %d %d" @@ fun n k ->
  let a = init n (fun _ -> scanf " %d" @@ fun v -> v) in
  let score =
    let t = make 40 0 in
    let bits = map bit a in
    let bits = init 40 (fun i -> init n (fun j -> bits.(j).(i))) in
    let pw = ref 1 in
    for i=0 to 39 do
      let z,o = fold_left (fun (z,o) -> function
      | 1 -> z+1,o
      | _ -> z,o+1) (0,0) bits.(i) in
      t.(i) <- (if i=0 then 0 else t.(i-1)) + !pw * max z o;
      pw := !pw * 2
    done; t
  in
  (* print_iarr score; *)
  let bk = bit k in
  (* print_iarr bk; *)
  let r = ref @@ fold_left (fun u v -> u lxor v) 0 a in
  iteri (fun i -> function
  | 1 -> r := max !r score.(i)
  | _ -> ()
  ) bk;
  print_int !r