#include <bits/stdc++.h>
using namespace std;
long long MAX = 100000000000;
long long MOD = 1000000007;
long long dp[100010][2];
long long sum[110];
void solve() {
  long long n;
  cin >> n;
  long long k;
  cin >> k;
  ;
  vector<long long> v;
  for (long long i = (0); i < (n); i++) {
    long long in;
    cin >> in;
    ;
    v.push_back(in);
  }
  sum[0] = v[0];
  for (long long i = (1); i < (n); i++) sum[i] = sum[i - 1] + v[i];
  dp[0][0] = 1;
  dp[0][1] = 1;
  for (long long i = (0); i < (n); i++) {
    for (long long j = (1); j < (k + 1); j++) {
      if (sum[i] >= j)
        dp[j][1] = (dp[j - 1][1] + dp[j][0] -
                    (j - v[i] > 0 ? dp[j - v[i] - 1][1] : 0)) %
                   MOD;
      else
        dp[j][1] = 0;
    }
    for (long long j = (0); j < (k + 1); j++) {
      dp[j][0] = dp[j][1];
    }
  }
  cout << dp[k][0] % MOD;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  long long test = 1;
  while (test--) {
    solve();
  }
}
