object Main extends App {

  import scala.io.StdIn._

  val Array(n, a) = readLine().split(' ').map(_.toInt)
  val values = readLine().split(' ').map(_.toInt).map(_ - a).toList
  def table : Map[Int, Long] ={
    def hoge(current: Map[Int, Long], values: List[Int]): Stream[Map[Int, Long]] = {

      def withValue(n: Int) = {
        val newKeys = current.keySet ++ current.keySet.map(_ + n)
        newKeys.map{k => k -> (current.getOrElse(k , 0L) + current.getOrElse(k - n, 0L))}.toMap
      }

      val next = values.headOption.map (withValue)

      val trail = next.map(hoge(_, values.tail)).getOrElse(Stream.Empty)
      current #:: trail
    }

    hoge(Map(0 -> 1), values)(n)
  }

  println(table(0) - 1)
}
