import Data.Bits(xor)
import Control.Arrow((&&&))
import Data.Maybe(listToMaybe)

main = do
    [n, k] <- fmap (read :: String -> Int) . words <$> getLine
    as <- fmap (read :: String -> Int) . words <$> getLine
    let mask = takeWhile ((<= k+1) . (2*)) $ fmap (2^) [0..]
    let fMax = f (sum $ g as <$> mask) as
    print $ max fMax $ maximum $ (0:) $ flip f as <$> [sum mask + 1..k]

f x = sum . fmap (xor x)
g xs x = if uncurry (>) (f x &&& sum $ xs) then x else 0
