export {}; const input = require("fs").readFileSync(0).toString().trim().split('\n'); const [N, S] = input[0].split(" ").map(Number); const nums = input[1].split(" ").map(Number); let [L, R] = [0,0]; let minLength = 100001; let acc = 0; while(true) { if(acc >= S) { minLength = Math.min(minLength, R-L); acc -= nums[L++]; } else if(R === N) break; else acc += nums[R++]; } console.log(minLength === 100001 ? 0 : minLength);