import qualified Data.IntMap as M
import Data.List
 
main = do
  [_,a] <- map read . words <$> getLine
  ds <- map ((a-) . read) . words <$> getLine
  print (tak ds)
 
tak = pred . (M.! 0) . foldr dp (M.singleton 0 1)
 
dp x m = M.unionWith (+) m (mapKeyValue (x+) id m)
 
mapKeyValue f g = M.fromList . map (\(k,v) -> (f k, g v)) . M.toList