import Control.Monad
import Data.Array
import Data.Bool

main = sol <$> get <*> get >>= print

get = fmap read . words <$> getLine

sol :: [Integer] -> [Integer] -> Integer
sol [n,a] as = dp!(n,0)-1
  where
  bs = (subtract a) <$> as
  ar = listArray (1,n) bs
  mx = n*max (maximum bs) (-minimum bs)
  bnds = ((0,-mx),(n,mx))
  dp = array bnds $ (,) <*> f <$> range bnds
    where
    f (0,0) = 1
    f (0,_) = 0
    f (i,j) = dp!(i-1,j) + bool 0 (dp!(i-1,j-ar!i)) (inRange bnds (i-1,j-ar!i))