#include <iostream>
#include <vector>
#include <queue>
#include <climits>
#include <algorithm>
using namespace std;
int main(void)
{
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int n, s;
cin >> n >> s;
vector<int> arr(n);
for (int i = 0; i < n; ++i)
{
cin >> arr[i];
}
int startIdx = 0;
int endIdx = 0;
int ans = INT_MAX;
int sum = 0;
sum += arr[startIdx];
while (startIdx < n)
{
if (sum >= s)
{
int num = endIdx - startIdx + 1;
sum -= arr[startIdx];
startIdx++;
if (ans > num)
{
ans = num;
}
}
else if (sum < s)
{
if (endIdx < n - 1)
{
endIdx++;
sum += arr[endIdx];
}
else
{
sum -= arr[startIdx];
startIdx++;
}
}
}
if (ans == INT_MAX)
{
cout << 0;
}
else
{
cout << ans;
}
return 0;
}