import           Control.Monad
import           Data.List

main :: IO ()
main = do
  [n, a] <- map read . words <$> getLine
  xs     <- map read . words <$> getLine

  let combi = replicateM n [True, False]
  print $ solve xs combi a 0
 where
  solve :: [Int] -> [[Bool]] -> Int -> Int -> Int
  solve xs []       a ans = ans
  solve xs (c : cs) a ans = if avgEq a (map fst $ filter snd $ zip xs c)
    then solve xs cs a (ans + 1)
    else solve xs cs a ans

  avgEq :: Int -> [Int] -> Bool
  avgEq _ [] = False
  avgEq q xs = sum xs `divMod` length xs == (q, 0)
