const main = input => { const Rows = input.trim().split('\n'); const [N, K] = Rows[0].trim().split(' ').map(n => Number(n)); const A = Rows[1].trim().split(' ').map(n => Number(n)); A.sort((a, b) => a - b); let k = K; const res = [1, 0] for (let i = 0; i < N; i++) { if (k - A[i] >= 0) { k -= A[i]; } else { res[0] = i; res[1] = k; break; } } console.log(res.join(' ')); } const input = require('fs').readFileSync('/dev/stdin', 'utf8'); main(input);