
object Main extends App {
  val sc = new java.util.Scanner(System.in) 
  var n = sc.nextInt()
  var x = sc.nextInt()
  sc.useDelimiter("\n")
  val a = sc.next().split(" ").map(_.toInt).toList.sorted
  
  def calc (x: Int, a: List[Int], acc: Int): Int = {
    a match {
      case h::Nil => {
        if (x - h == 0) {
          acc + 1
        } else {
          acc
        }
      }
      case h::t => {
        if (x >= h) {
          calc(x-h, t, acc+1)
        } else {
          acc
        }
      }
    }
  }
  println(calc(x, a, 0))
}