# 백준 1806번 부분합

## Solution

import java.io.*;
import java.util.*;

public class Main {
static StringBuilder sb = new StringBuilder();

static int n, S;
static int[] a;

static void input() {
n = scan.nextInt();
S = scan.nextInt();
a = new int[n + 1];
for (int i = 1; i <= n; i++) {
a[i] = scan.nextInt();
}
}

static void pro() {
int R = 0, sum = 0, ans = n + 1;
for (int L = 1; L <= n; L++) {
sum -= a[L - 1];

while (R < n && sum < S) {
R++;
sum += a[R];
}

if (sum >= S) {
ans = Math.min(ans, R - L + 1);
}
}

if (ans == n + 1) ans = 0;
System.out.println(ans);
}

public static void main(String[] args) {
input();
pro();
}

StringTokenizer st;

}

public FastReader(String s) throws FileNotFoundException {
}

String next() {
while (st == null || !st.hasMoreElements()) {
try {
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}

int nextInt() {
return Integer.parseInt(next());
}

long nextLong() {
return Long.parseLong(next());
}

double nextDouble() {
return Double.parseDouble(next());
}

String nextLine() {
String str = "";
try {
}