import qualified Data.Map as M
f m x = M.unionWith (+) m (M.mapKeysMonotonic (x+) m)
main = do [n,a] <- fmap (map read . words) getLine
          xs <- fmap (map (subtract a . read) . words) getLine
          print $ foldl f (M.singleton 0 1) xs M.! 0 - 1