import Data.List                                                                                                                                      
                                                                                                                                                      
main :: IO ()                                                                                                                                         
main = do                                                                                                                                             
  [n,a] <- map read . words <$> getLine :: IO [Int]                                                                                                   
  xs <- map read . words <$> getLine :: IO [Int]                                                                                                      
  print . length . filter (==Just a) . map average . subsequences $ xs                                                                                
                                                                                                                                                      
average :: [Int] -> Maybe Int                                                                                                                         
average [] = Nothing                                                                                                                                  
average xs = let s = sum xs                                                                                                                           
                 l = length xs                                                                                                                        
             in if s`mod`l==0                                                                                                                         
                then Just $ s`div`l                                                                                                                   
                else Nothing