import Data.List (subsequences)

main:: IO ()
main = do
    [n,p] <- (map read . words) <$> getLine
    as <- (map read . words) <$> getLine
    print $ solve p as

-- |
--
-- >>> solve 0 [1,3]
-- 2
--
solve :: Int -> [Int] -> Int
solve p = length . filter f . subsequences
  where f xs = sum xs `mod` 2 == p

