object Main extends App {
  var a = readLine.split(" ").map(_.toInt)
  var b = readLine.split(" ").map(_.toInt).sorted
  var sum = 0
  for(i <- 0 until a(0) if( a(1) > b(i))) {
    sum = sum + 1
    a(1) = a(1) - b(i)
  }
  print(sum)
}