#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<class base_t>
struct modint
{
	using mod_t = modint<base_t>;
	base_t val;
	static base_t mod;

	template<class T>
	inline base_t normalize(T n)
	{
		if(n >= mod || n < -mod)
			n %= mod;
		if(n < 0)
			n += mod;
		return (base_t)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);}
	const base_t operator ()() const { return val;}

	mod_t operator + (const mod_t& o)
	{
		base_t a = val + o(); if(a >= mod) a -= mod; return mod_t(a);
	}
	mod_t operator - (const mod_t& o)
	{
		base_t a = val - o(); if(a < 0) a += mod; return mod_t(a);
	}
	mod_t operator * (const mod_t& o)
	{
		if(is_same<base_t, int>::value)
			return normalize((ll)val * (ll)o());
		if(is_same<base_t, ll>::value)
		{
			ll x = (ll)((long double)val * o() / mod);
			ll y = (ll)((long double)val * o() - x * mod);
			return y;
		}
		assert(true);
	}
	mod_t operator / (const mod_t& o) { return *this * inverse(o(), mod);}

	mod_t& operator += (const mod_t& o) { return *this = *this + o;}
	mod_t& operator -= (const mod_t& o)	{ return *this = *this - o;}
	mod_t& operator *= (const mod_t& o)	{ return *this = *this * o;}
	mod_t& operator /= (const mod_t& o)	{ return *this = *this / o;}

	template<class T>
	mod_t& operator += (const T& o) { return *this = *this + mod_t(o);}
	template<class T>
	mod_t& operator -= (const T& o) { return *this = *this - mod_t(o);}
	template<class T>
	mod_t& operator *= (const T& o) { return *this = *this * mod_t(o);}
	template<class T>
	mod_t& operator /= (const T& o) { return *this = *this / mod_t(o);}
	
	mod_t& operator ++ () { return *this += 1;}
	mod_t& operator -- () { return *this -= 1;}
	mod_t operator ++ (int) { mod_t old(val); *this += 1; return old;}
	mod_t operator -- (int) { mod_t old(val); *this -= 1; return old;}

	bool operator == (const mod_t& o) { return val == o();}
	bool operator != (const mod_t& o) { return val != o();}
	bool operator < (const mod_t& o) { return val < o();}
	bool operator > (const mod_t& o) { return val > o();}
	bool operator <= (const mod_t& o) { return val <= o();}
	bool operator >= (const mod_t& o) { return val >= o();}

	friend istream& operator >> (istream& in, mod_t& o)
	{
		ll x; in >> x; o = mod_t(x); return in;		
	}

	friend ostream& operator << (ostream& out, const mod_t& o)
	{
		out << o(); return out;		
	}
};

template<class T, class base_t>
modint<base_t> operator + (T a, const modint<base_t>& b) { return a + b();}
template<class T, class base_t>
modint<base_t> operator - (T a, const modint<base_t>& b) { return a - b();}
template<class T, class base_t>
modint<base_t> operator * (T a, const modint<base_t>& b) { return a * b();}
template<class T, class base_t>
modint<base_t> operator / (T a, const modint<base_t>& b) { return a / b();}

template<class T, class base_t>
bool operator == (T a, const modint<base_t>& b) { return a == b();}
template<class T, class base_t>
bool operator != (T a, const modint<base_t>& b) { return a != b();}
template<class T, class base_t>
bool operator < (T a, const modint<base_t>& b) { return a < b();}
template<class T, class base_t>
bool operator <= (T a, const modint<base_t>& b) { return a <= b();}
template<class T, class base_t>
bool operator > (T a, const modint<base_t>& b) { return a > b();}
template<class T, class base_t>
bool operator >= (T a, const modint<base_t>& b) { return a >= b();}

template<class base_t>
base_t modint<base_t>::mod(MOD);
// template<class base_t>
// base_t& md = modint<base_t>::mod;

const int N = 110, K = 1e5 + 10;
int n, k, a[N];
modint<int> 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] = int(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: 43648