import Control.Monad
import Data.Maybe
import Data.Array.Unboxed ((!))
import qualified Data.Array.Unboxed as A
import qualified Data.Array.IO as A
import qualified Data.ByteString.Char8 as B

main :: IO ()
main = do
    [n, a] <- map read . words  <$> getLine :: IO [Int]
    ns <- map (fst . fromJust . B.readInt) . B.words  <$> B.getLine :: IO [Int]
    print =<< dp a n ns

dp :: Int -> Int -> [Int] -> IO Int
dp a n ns' = do
    memo <- A.newArray ((0, 0), (n, n*a)) 0 :: IO (A.IOUArray (Int, Int) Int)

    forM_ [(i,j,k)|i<-[0..n], j<-[0..n], k<-[0..n*a]] $ \(i,j,k) -> do
        A.writeArray memo (j,k) =<< f memo i j k

    sum <$> (forM [(j,k)|j<-[1..n], k<-[0..50*n], mod k j == 0, div k j == a] $ \(j,k) -> 
        memo `A.readArray` (j,k))
    where
    ns = A.array (1,n) $ zip [1..] ns' :: A.UArray Int Int
    -- f (nsのインデックス) (使う枚数) (値) = 何組あるか
    f _ 0 0 0 = return 1
    f _ 0 _ _ = return 0
    f memo i j k 
        | j>0 && k-(ns!i) >= 0 = do a <- memo `A.readArray` (j,k)
                                    b <- memo `A.readArray` (j-1,k - ns!i)
                                    return $ a + b
        | otherwise            = memo `A.readArray` (j,k)