import           Control.Monad
import           Data.Bits
import qualified Data.ByteString.Char8 as BS
import           Data.Maybe

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
  [n, p] <- getIntList
  as <- getIntList

  let checkAs [] res = res
      checkAs (x:xs) res | x `mod` 2 == 1 = checkAs xs (res+1)
                         | otherwise      = checkAs xs res

      oddExists = checkAs as 0 > 0

      ans :: Int
      ans | oddExists || p == 0 = 1 `shiftL` (n-1)
          | otherwise = 0

  print ans