
object Main extends App {


  val Array(n, x) = scala.io.StdIn.readLine.split(" ").map(_.toInt)
  val data = scala.io.StdIn.readLine.split(" ").map(_.toInt).sorted

  var memo: Map[(Int, Int), Int] = Map.empty

  def exec(num: Int, nowSize: Int): Int = {
    memo.get((num, nowSize)) match {
      case Some(a) => a
      case None =>
        if (num == data.length - 1) {
          if (nowSize == data(num)) {
            1
          } else {
            0
          }
        } else {
          if (nowSize < data(num)) {
            return 0
          }

          var rtn = List.empty[Int]
          if (nowSize >= data(num)) {
            rtn = rtn :+ (exec(num + 1, nowSize - data(num)) + 1)
          }
          rtn = rtn :+ exec(num + 1, nowSize)
          memo = memo + ((num, nowSize) -> rtn.max)
          rtn.max
        }
    }
  }

  println(exec(0, x))
}
