let i = require('fs').readFileSync('/dev/stdin', 'utf8').split('\n') let a = i[0].split(' ').map((e) => parseInt(e)) let b = i[1].split(' ').map((e) => parseInt(e)).sort((a,b) => a-b) let c = 0 for (; c < b.length; c++) { if ((a[1] -= b[c]) <= 0) { if (a[1] == 0) c++ break } } console.log(c)