import java.util.Scanner

import scala.annotation.tailrec

object Main extends App {
  val sc = new Scanner(System.in)
  val n = sc.nextInt

  val a = sc.nextInt
  val xs = Vector.fill(n)(sc.nextInt)

  val ns = List.range(0, n)
  val first = ns.map(x => (1, xs(x), ns.dropWhile(_ <= x)))

  var ans = first.count { case (_, i, _) => i == a }

  //divisor, sum, rests of indexes
  def run(first: Seq[(Int, Int, Seq[Int])]): Seq[(Int, Int, Seq[Int])] =
    for {
      (d, x, in) <- first
      xx <- in
    } yield {
      val i = x + xs(xx)
      val nd = d + 1
      val expects = a * nd
//      println((x, in, xs(xx)))
//      println(s"  $i == $expects")
      if (i == expects) {
//        println(s"    ↑↑↑")

        ans += 1
      }
      val rest = in.dropWhile(_ <= xx)

      (nd, i, rest)
    }

  @tailrec
  def lp(first: Seq[(Int, Int, Seq[Int])]): Unit = {
    val a = run(first)
    if (a.forall(_._3.isEmpty)) {
    } else {
      lp(a)
    }
  }

  lp(first)
  println(ans)
}
