#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector < int > vi;
typedef long long int int64;
typedef unsigned long long uLL;
#define MEM(a,b) memset(a,(b),sizeof(a))
#define tr(c,it) for(typeof((c).begin()) it = (c).begin(); it != (c).end(); it++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define ain(a,n) int ((a)[(n)]); for(int i=0; i<(n); i++) cin>>((a)[i])
#define FOR(i,n) for(int i=0;i<n;i++)
#define FU(i,a,n) for(int i=a;i<=n;i++)
#define FD(i,a,n) for(int i=n;i>=a;i--)
#define GI(n) scanf("%d",&(n))
#define mod 1000000007
#define INF 2100000000
#define MAXN 500007
int n;
ll dp[MAXN],h[MAXN],H[MAXN],m;
ll solve(int idx){
if(idx >= n) return 1;
ll ret = dp[idx];
if(ret != -1) return ret;
ret = 0;
for(int i=idx+1;i<=n;i++){
if(H[i]-H[idx] <= m){
ret += (solve(i));
}
}
dp[idx] = ret;
return ret;
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
MEM(dp,-1);
cin>>n>>m;
FOR(i,n){
cin>>h[i];
}
FU(i,1,n){
H[i] = H[i-1] + h[i-1];
// cout<<H[i]<<endl;
}
cout<<solve(0)<<endl;
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKdHlwZWRlZiBsb25nIGxvbmcgbGw7CnR5cGVkZWYgcGFpcjxpbnQsIGludD4gcGlpOwp0eXBlZGVmIHZlY3RvciA8IGludCA+IHZpOwp0eXBlZGVmIGxvbmcgbG9uZyBpbnQgaW50NjQ7CnR5cGVkZWYgdW5zaWduZWQgbG9uZyBsb25nIHVMTDsKI2RlZmluZSBNRU0oYSxiKSBtZW1zZXQoYSwoYiksc2l6ZW9mKGEpKQojZGVmaW5lIHRyKGMsaXQpIGZvcih0eXBlb2YoKGMpLmJlZ2luKCkpIGl0ID0gKGMpLmJlZ2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