#include <bits/stdc++.h>
using namespace std;
const long long N = 109, K = 100009, MOD = 1e9 + 7;
long long n, k, a[N], dp[N][K], dp2[N][K];
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cin >> n >> k;
  for (long long i = 1; i <= n; ++i) cin >> a[i];
  for (long long j = 0; j <= k; ++j) {
    if (a[1] < j) {
      if (j != 0) dp2[1][j] += dp2[1][j - 1];
      continue;
    }
    dp[1][j] = 1;
    dp2[1][j] = dp[1][j];
    if (j != 0) dp2[1][j] += dp2[1][j - 1];
    dp[1][j] %= MOD;
    dp2[1][j] %= MOD;
  }
  for (long long i = 2; i <= n; ++i) {
    for (long long j = 0; j <= k; ++j) {
      long long t = max(0LL, j - a[i]);
      if (t != 0)
        dp[i][j] = dp2[i - 1][j] - dp2[i - 1][t - 1];
      else
        dp[i][j] = dp2[i - 1][j];
      dp2[i][j] = dp[i][j];
      if (j != 0) dp2[i][j] += dp2[i][j - 1];
      dp[i][j] %= MOD;
      dp2[i][j] %= MOD;
    }
  }
  cout << dp[n][k] << endl;
}
