import Data.Bits(xor, testBit)

main = do
    [n, k] <- fmap read . words <$> getLine
    as <- fmap read . words <$> getLine
    let digits = takeWhile (\n -> 2^(n+1)-1 <= k) [0..]
    let mask = (<n) <$> (2*) . flip count as <$> digits
    let xMax = sum $ zipWith (\b n -> if b then 2^n else 0) mask digits
    let res = succ $ sum $ (2^) <$> digits
    print $ maximum $ flip f as <$> xMax:[res..k]

f x = sum . fmap (`xor` x)
count n = length . filter id . fmap (`testBit` n)
