#include <bits/stdc++.h>
#define lli long long int
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,a,n) for(int i = a; i < n; i++)
#define s(n) cin >> n
#define csl ios_base::sync_with_stdio(false); cin.tie(NULL)
#define rsz(x,n) x.clear(); x.resize(n)
#define rrsz(x,a,n) x.clear(); x.resize(n,a)
#define wt while(true)
#define all(x) x.begin(),x.end()
#define pb push_back
#define ls(x) ((2*(x)) + 1)
#define rs(x) ((ls(x)) + 1)
#define md(a,b) (((a) + (b))/2)
#define INF (1e9 + 7)
using namespace std;

int main()
{
    lli n,m;
    s(n);s(m);
    lli a[n+1]={0};
    reps(i,1,n+1)s(a[i]);
    vector<vector<lli>>vec(n+2,vector<lli>(m+2,0));
    vec[0][0]=1;
    rep(i,n+1)
    {
        rep(j,m+1)
        {
            rep(k,a[i]+1)
            {
                if((j-k)>=0&&i>=1)
                vec[i][j]+=vec[i-1][j-k];
        }   }
    }
     cout<<vec[n][m];
    return 0;
}