function main(arg) {
    arg = arg.split("\n")
    var x = parseInt(arg[0].split(" ")[1], 10)
    var ai = arg[1].split(" ").map((e) => parseInt(e, 10))

    ai.sort((a,b) => {
        if (a > b) {return 1}
        return -1
    })
    
    if (x < Math.min.apply(null, ai)) {
        console.log(0)
        return
    }

    var count = ai.slice()
    count.fill(0)
    var max = x
    
    for(var j = 0; j < 10; j++) {
        
        for (var i = 0; i < ai.length; i++) {
            if((max - ai[i]) >= 0) {
                max -= ai[i]
                count[i] ++
            }
        }

        if(max <= 0) {
            break;
        }
    }
  
    var count2 = 0
    count.forEach((e) => {
        if(1 === e) {
            count2++
        }
    })
    
    console.log(count2)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));