// This code was written by WuTan
#include <bits/stdc++.h>
#define io_faster ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define EL cout<<'\n'
#define pli pair<ll,int>
#define pii pair<int,int>
#define fi first
#define se second
#define PROB "Candies"

using namespace std;
typedef long long ll;
typedef unsigned long long ull;

template <typename T>
inline void read(T& x)
{
    bool Neg = false;
    char c;
    for (c = getchar(); c < '0' | c > '9'; c = getchar())
        if (c == '-') Neg = !Neg;
    x = c - '0';
    for (c = getchar(); c >= '0' && c <= '9'; c = getchar())
        x = x * 10 + c - '0';
    if (Neg) x = -x;
}

template <typename T>
inline void write(T x)
{
    if (x < 0)
    {
        putchar('-'); x = -x;
    }
    T p = 1;
    for (T temp = x / 10; temp > 0; temp /= 10) p *= 10;
    for (; p > 0; x %= p, p /= 10) putchar(x / p + '0');
}

namespace bignum{
	void fix(string &a, string &b){
		while (a.length()<b.length()) a = "0" + a;
		while (b.length()<a.length()) b = "0" + b;
	}

	string operator + (string a, string b){
		long int sum, carry = 0, i;
		string c = "";

		fix(a, b);
		for (i = a.length() - 1; i >= 0; i--){
			sum = a[i] - 48 + b[i] - 48 + carry;
			carry = sum / 10;
			c = char(sum % 10 + 48) + c;
		}
		if (carry>0) c = "1" + c;
		return c;
	}

	string multi(string a, int b){
		if (b == 0) return "0";
		if (b == 1) return a;
		string tmp = multi(a, b / 2);
		if (b % 2 == 0) return tmp + tmp;
		else return a + tmp + tmp;
	}

	string operator * (string a, string b){
		string res = "";
		int n = a.length();
		int m = b.length();
		int len = n + m - 1;
		int carry = 0;
		for (int i = len; i >= 0; i--){
			int tmp = 0;
			for (int j = n - 1; j >= 0; j--)
				if (i - j <= m && i - j >= 1){
					int a1 = a[j] - 48;
					int b1 = b[i - j - 1] - 48;
					tmp += a1*b1;
				}
			tmp += carry;
			carry = tmp / 10;
			res = (char)(tmp % 10 + 48) + res;
		}
		while (res.length()>1 && res[0] == '0') res.erase(0, 1);
		return res;
	}
}
using namespace bignum;

void file(){
#ifndef ONLINE_JUDGE
	freopen(PROB".inp","r",stdin);
	freopen(PROB".out","w",stdout);
#endif
}

// Talk less
// Love more
const int N = 105, K = 1e5 + 5;
const ll mod = 1e9 + 7;
ll f[K], t[K], dp[K];
int n, k, a[N];
void readinp(){
    cin >> n >> k;
    for (int i=1;i<=n;i++)
        cin >> a[i];
}

void solve(){
    /*
    f[0] = 1;
    for (int i=1;i<=n;i++){
        for (int j=k;j>=0;j--){
                for (int d=1;d<=a[i];d++){
                    if (j + d <= k)
                        f[j+d]+= f[j],
                        f[j+d]%=mod;
                }
            }

    }
    cout << f[k];
    */

    dp[0] = t[0] = 1;
    for (int i=1;i<=k;i++)
        t[i]+= t[i-1];

    for (int i=1;i<=n;i++){
//        cout << i << endl;
        for (int j=k;j>=1;j--){
            int p = min(j, a[i]);
            ll inc = (t[j - 1] - t[j - p - 1] + mod) % mod;
//            cout << j - p << " " << j - 1 << " " << inc << endl;
            dp[j]+= inc, dp[j]%= mod;
        }
        for (int j=0;j<=k;j++)
            t[j] = dp[j];
        for (int j=1;j<=k;j++)
            t[j]+= t[j-1], t[j]%= mod;
//        for (int j=0;j<=k;j++)
//            cout << dp[j] << " ";
//        EL;EL;
    }
    cout << dp[k];

}

int main(){
    io_faster
    file();
    int t = 1;
//    cin >> t;
    while (t--){
        readinp();
        solve();
    }
}


Measured memory_bytes: 5188