object Main extends App {
  @scala.annotation.tailrec
  def loop(ints: Seq[Int], count: Int, rest: Int): Int = ints match {
    case Seq(x) => if (x == rest) count + 1 else count
    case x :: xs if x <= rest => loop(xs, count + 1, rest - x)
    case _ => count
  }
  val sc = new java.util.Scanner(System.in)
  val n, x = sc.nextInt()
  val ints = List.fill(n)(sc.nextInt()).sorted
  println(loop(ints, 0, x))
}