f a s k [] | k>0, a*k==s = 1
           | otherwise   = 0
f a s k (x:xs) = f a (s+x) (k+1) xs + f a s k xs

readnums :: IO [Int]
readnums = map read . words <$> getLine

main = do
  [_,a] <- readnums
  xs <- readnums
  print $ f a 0 0 xs