package main

import "fmt"
import "sort"

func main(){
	var N int64
	var x int64
	var a [100]float64
	var count int

	fmt.Scan(&N, &x)
	b := make([]float64, int(N), 1000)
	for i := 0 ; i < int(N) ; i++{
		fmt.Scan(&a[i])
	}

	for i := 0 ; i < int(N) ; i++ {
		b[i] = a[i]
	}
	sort.Float64s(b)

	for i := 0 ; i < int(N) ; i++{
		x = x - int64(b[i])
		if x < 0 { break }
		count++
	}
	// fmt.Println(b)
	fmt.Println(count)
}