import Control.Monad
import Control.Monad.ST

import Data.Array.ST
import Data.Array.Unboxed

type Idx = (Int,Int)
type STDp s  = STUArray s Idx Int

main = do
    [n,a] <- map read.words<$>getLine::IO[Int]
    ys <- map (flip(-)a.read).words<$>getLine::IO[Int]
    --
    print $ solve n a ys
--
solve :: Int -> Int -> [Int] -> Int
solve n a ys = runST $ do
    dp <- newArray ((0,lb),(n,ub)) 0 :: ST s (STDp s)
    writeArray dp (0,0) 1
    forM_ [(j,i,y)| (j,y)<-zip [1..] ys, i<-[lb..ub]]  $ \(j,i,y) -> do
        if i-y<lb || i-y>ub
            then writeArray dp (j,i) =<< readArray dp (j-1,i)
            else writeArray dp (j,i) =<< (+) <$> readArray dp (j-1,i) <*> readArray dp (j-1,i-y)
    (+ (-1)) <$> readArray dp (n,0)
    where
        lb = n*a*(-1)
        ub = n*a