package main import . "fmt" import . "sort" func main() { var n,m int Scan(&n,&m) c:=make([]int,n) for i:=range c { Scan(&c[i]) } Ints(c) a:=0 for _,x:=range c{ if x<=m { a++ } m-=x if m<1 { break } } Println(a) }