
///╔══╗
///╚╗╔╝
///╔╝╚(¯`v´¯)
///╚══╝`.¸.´farzin


#include <bits/stdc++.h>

#define int int64_t
#define pb push_back
#define ibsws ios_base::sync_with_stdio
#define gcd __gcd
#define s second
#define f first
#define mp make_pair
typedef std::pair<int,int> pii ;

using namespace std;

const int N=110,K=1e5+1e2;
int n,dp[N][K],ps[N][K],k,a[N];

int32_t main(){
	ibsws(true==false);
    cin>>n>>k;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    for(int i=0;i<=k;i++){
        dp[1][i]=(a[1]>=i);
        ps[1][i]=ps[1][max(0ll,i-1)]+dp[1][i];
    }
    for(int i=2;i<=n;i++){
        for(int j=0;j<=k;j++){
            if(j<=a[i]){
                dp[i][j]=ps[i-1][j];
            }
            else{
                dp[i][j]=ps[i-1][j]-ps[i-1][j-a[i]-1];
            }
            ps[i][j]=ps[i][j-1]+dp[i][j];
        }
    }
    /*/
    for(int i=1;i<=n;i++){
        for(int j=0;j<=k;j++){
            cout<<i<<' '<<j<<':'<<dp[i][j]<<'\n';
        }
    }//*/
    cout<<dp[n][k];
}
