module IntPairMap = Map.Make (struct
  type t = int * int
  let compare = compare 
end)

let () = Scanf.scanf "%d %d\n" @@ fun n a ->
  let xs = Array.init n @@ fun _ ->
    Scanf.scanf "%d " @@ fun x -> x in
  let dp = 
    Array.fold_left (fun curr x ->
      IntPairMap.fold (fun (sum, n) count acc ->
        IntPairMap.add (sum + x, n + 1)
          (count + try IntPairMap.find (sum + x, n + 1) acc with Not_found -> 0) acc) curr curr) (IntPairMap.singleton (0, 0) 1) xs in
  Array.init n (fun i ->
    try IntPairMap.find (a * (i + 1), i + 1) dp with Not_found -> 0)
  |> Array.fold_left ( + ) 0
  |> Printf.printf "%d\n"

