#include <bits/stdc++.h>
using namespace std;
long long a, b, c, d, e, mod = 1000000007, f[100009], dp[100009], dp2[100009];
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> a >> b;
  for (c = 1; c <= a; c++) cin >> f[c];
  for (c = 0; c <= f[1]; c++) dp[c] = 1;
  for (c = 1; c <= b; c++) {
    dp[c] += dp[c - 1];
    dp[c] %= mod;
  }
  for (c = 2; c <= a; c++) {
    for (d = 0; d <= b; d++) {
      e = max(d - f[c], 0LL);
      dp2[d] = dp[d];
      if (e != 0) dp2[d] = dp2[d] - dp[e - 1] + mod;
      dp2[d] %= mod;
    }
    for (d = 1; d <= b; d++) {
      dp2[d] += dp2[d - 1];
      dp2[d] %= mod;
    }
    for (d = 0; d <= b; d++) {
      dp[d] = dp2[d];
      dp2[d] = 0;
    }
  }
  cout << dp[b] - dp[b - 1];
  return 0;
}
