#include <bits/stdc++.h>
using namespace std;

#define LEN(x) (int)x.size()
#define ALL(x) x.begin(), x.end()

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
typedef vector<pii> vpii;

const int MOD = 1'000'000'007;
const double EPS = 0.000'000'001;

inline int fcmp(double x, double y)
{ return (x < y + EPS ? (x < y - EPS ? -1 : 0) : 1);}

template<const ll mod>
struct modint
{
    ll val;
    
    inline ll normalize(ll n)
    {
        if(n >= mod || n < -mod)
            n %= mod;
        if(n < 0)
            n += mod;
        return n;
    }

    modint(){ val = 0;}
    template<class T> modint(T x = 0) { val = normalize(x);}
    template<class T> explicit operator T() { return static_cast<T>(val);}

    modint<mod>& operator += (const modint<mod> o) { return *this = modint<mod>(val + o.val);}   
    template<class T> modint<mod>& operator += (const T o) { return *this = modint<mod>(val + normalize(o));}   
    modint<mod>& operator -= (const modint<mod> o) { return *this = modint<mod>(val - o.val);}   
    template<class T> modint<mod>& operator -= (const T o) { return *this = modint<mod>(val - normalize(o));}   
    modint<mod>& operator *= (const modint<mod> o) { return *this = modint<mod>(val * o.val);}   
    template<class T> modint<mod>& operator *= (const T o) { return *this = modint<mod>(val * normalize(o));}

    modint<mod>& operator++() { return *this += 1;}
    modint<mod>& operator--() { return *this -= 1;}

    modint<mod> operator + (const modint<mod> o) { return modint<mod>(val + o.val);}   
    template<class T> modint<mod> operator + (const T o) { return modint<mod>(val + o);}   
    modint<mod> operator - (const modint<mod> o) { return modint<mod>(val - o.val);}   
    template<class T> modint<mod> operator - (const T o) { return modint<mod>(val - o);}   
    modint<mod> operator * (const modint<mod> o) { return modint<mod>(val * o.val);}   
    template<class T> modint<mod> operator * (const T o) { return modint<mod>(val * o);}

    bool operator == (const modint<mod> o) { return val == o.val;}
    template<class T> bool operator == (const T o) { return val == normalize(o);}
    bool operator != (const modint<mod> o) { return val != o.val; }
    template<class T> bool operator != (const T o) { return val != normalize(o);}

    bool operator < (const modint<mod> o) { return val < o.val;}
    template<class T> bool operator < (const T o) { return val < normalize(o);}

    modint<mod>& operator /= (const modint<mod> o) { return *this *= o.inv();}
    template<class T> modint<mod>& operator /= (const T o) { return *this *= modint<mod>(o).inv();}
    modint<mod> operator / (modint<mod> o) {modint<mod> ans(val); return ans * o.inv();}
    template<class T> modint<mod> operator / (T o) { return modint<mod>(val) / modint<mod>(o);}

    modint<mod> inv() { return fexp(*this, mod - 2);}

    friend istream& operator >> (istream& in, modint<mod>& n)
    {
        ll x; in >> x;
        n = modint<mod>(x);
        return in;
    }

    friend ostream& operator << (ostream& out, modint<mod>& n)
    {
        return out << n.val;
    }
};

const int N = 110, K = 1e5 + 10;
int n, k, a[N];
modint<MOD> dp[N][K], sum[K];

int main()
{
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    ios_base::sync_with_stdio(false);
    cout.precision(10);

    cin >> n >> k;

    for(int i = 0; i < n; i++) cin >> a[i];

    for(int j = 0; j <= k; j++)
        dp[0][j] = j <= a[0];
    
    for(int j = 1; j <= k + 1; j++)
        sum[j] = sum[j - 1] + dp[0][j - 1];

    for(int i = 1; i < n; i++)
    {   
        for(int j = 0; j <= k; j++)
        {
            int x = max(0, j - a[i]);
            dp[i][j] = sum[j + 1] - sum[x];
        }

        for(int j = 1; j <= k + 1; j++)
            sum[j] = sum[j - 1] + dp[i][j - 1];
    }

    cout << dp[n - 1][k] << endl;

    return 0;
}


Measured memory_bytes: 87168