import Data.List

main :: IO ()
main = do
    [n,p] <- getInts
    as <- getInts
    print $ solve p as

getInts :: IO [Int]
getInts = map read . words <$> getLine

solve :: Int -> [Int] -> Int
solve p = length . filter (\xs->sum xs `mod` 2 == p) . subsequences
