let n, a = Scanf.scanf "%d %d" (fun x y -> x, y)
let xs = Array.init n (fun _ -> Scanf.scanf " %d" (fun x -> x-a))
let len = 2*(50*50+1)
let arr = Array.make_matrix (n+1) len 0
let () =
  arr.(0).(len / 2) <- 1;
  xs |> Array.iteri begin fun i e ->
    Array.init len begin fun j -> 
      arr.(i+1).(j) <- arr.(i+1).(j) + arr.(i).(j);
      if 0 <= j + e && j + e < len then
        arr.(i+1).(j+e) <- arr.(i+1).(j+e) + arr.(i).(j)
    end |> ignore
  end;
  Printf.printf "%d\n" (arr.(n).(len / 2) - 1)
