#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const long long INF = 1e18;
const double EPS = 1e-6;
const int MAX_N = 105;
const int MAX_K = 1e5 + 5;
namespace modOp {
int add(int a, int b, int mod = MOD) { return (a + b) % mod; }
int sub(int a, int b, int mod = MOD) { return (a - b + mod) % mod; }
int mul(int a, int b, int mod = MOD) { return (long long)a * b % mod; }
}  // namespace modOp
using namespace modOp;
int N, K;
int a[MAX_N];
long long dp[MAX_N][MAX_K];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> N >> K;
  for (int i = 1; i <= N; ++i) {
    cin >> a[i];
  }
  dp[0][0] = 1;
  for (int i = 1; i <= N; ++i) {
    for (int j = 0; j < K; ++j) {
      dp[i][j] = dp[i - 1][j];
      if (j != 0) dp[i - 1][j] = add(dp[i - 1][j], dp[i - 1][j - 1]);
    }
    for (int j = K; j >= 1; --j) {
      dp[i][j] = add(
          dp[i][j],
          sub(dp[i - 1][j - 1], (j - a[i] <= 0 ? 0 : dp[i - 1][j - a[i] - 1])));
    }
  }
  cout << dp[N][K] << '\n';
  return 0;
}
