#include<bits/stdc++.h>
typedef int ll;
using namespace std;
#define endl '\n'
const ll mod=1e9+7;
#define N 100005
ll a[N],dp[ll(105)][N],n,k;
ll solve(ll idx,ll taken){
if(idx==n+1 && taken==k)return 1;
if(taken>k || index>n)return 0;
if(taken==k)return 1;
if(dp[idx][taken]!=-1)return dp[idx][taken];
ll ans=0;
for(ll i=0;i<=a[idx];i++)ans+=solve(idx+1,taken+i);
return dp[idx][taken]=ans;
}
int main(){
    ios_base::sync_with_stdio(false),cin.tie(NULL);
    cin>>n>>k;
    memset(dp,-1,sizeof(dp));
    for(ll i=1;i<=n;i++)cin>>a[i];
    cout<<solve(1ll,ll(0))<<endl;
    return 0;
}
