import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner kb = new Scanner(System.in);
int n = kb.nextInt();
int s = kb.nextInt();
int[] nums = new int[n+1];
for (int i = 0; i < n; i++) {
nums[i] = kb.nextInt();
}
int minLength = Integer.MAX_VALUE;
int sum = 0;
int lt = 0, rt = 0;
while(rt<= n) {
if(sum>=s) {
minLength = Math.min(rt-lt, minLength);
sum -= nums[lt++];
}else {
sum += nums[rt++];
}
}
if (minLength == Integer.MAX_VALUE) {
System.out.println(0);
} else {
System.out.println(minLength);
}
}
}