#include <bits/stdc++.h>
#define range(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, b) for (int i = 0; i < (b); i++)
#define ranger(i, a, b) for (int i = (a)-1; i >= (b); i--)
#define repr(i, b) for (int i = (b)-1; i >= 0; i--)
#define all(a) (a).begin(), (a).end()
#define show(x) cerr << #x << " = " << (x) << endl;
#define int long long
using namespace std;

template <typename X, typename T>
auto vectors(X x, T a) {
	return vector<T>(x, a);
}
template <typename X, typename Y, typename Z, typename... Zs>
auto vectors(X x, Y y, Z z, Zs... zs) {
	auto cont = vectors(y, z, zs...);
	return vector<decltype(cont)>(x, cont);
}

template <typename T>
ostream& operator<<(ostream& os, vector<T>& v) {
	rep(i, v.size()) { os << v[i] << (i == v.size() - 1 ? "" : " "); }
	return os;
}
template <typename T, typename S>
ostream& operator<<(ostream& os, pair<T, S>& p) {
	os << '(' << p.first << ',' << p.second << ')';
	return os;
}
template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
	for (T& x : v) { is >> x; }
	return is;
}

const int M = 1000000007;

vector<vector<int>> dp;
signed main() {
	int n, k;
	cin >> n >> k;

	vector<int> a(n);
	cin >> a;

	dp = vectors(n + 1, 1000005, 0LL);

	dp[0][0] = 1;
	rep(i, n) {
		rep(j, k + 1) {
			dp[i + 1][j + 0] += dp[i][j];
			dp[i + 1][min(100004ll, j + a[i] + 1)] -= dp[i][j];
		}
		rep(j, k) { (dp[i + 1][j + 1] += dp[i + 1][j]) %= M; }
	}
	cout << dp[n][k] % M << endl;
}
