import Data.List( subsequences)
main = do
    [n,a] <- return . map (read::String->Int) . words =<< getLine
    xs <- return . map read . words =<< getLine
    let powerset = tail $ subsequences xs
	powerset::[[Int]]
	predication list =
	  let
	    (ave,md) = sum list `divMod` length list
	  in
	    md==0 && ave==a
    print . length $ filter predication powerset