#include <bits/stdc++.h>
using namespace std;
template <class T>
ostream &operator<<(ostream &o, const vector<T> &v) {
  o << "{";
  for (int i = 0; i < (int)v.size(); i++) o << (i > 0 ? ", " : "") << v[i];
  o << "}";
  return o;
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
  std::fill((T *)array, (T *)(array + N), val);
}
int mod = 1e9 + 7;
int dp[120][100100];
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> v(n);
  for (int i = (int)(0); i < (int)(n); ++i) {
    cin >> v[i];
  }
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int ko = 0; ko <= k; ko++) {
      if (ko == 0) {
        dp[i][0] = 1;
      } else if (ko <= v[i - 1]) {
        dp[i][ko] = (dp[i][ko - 1] + dp[i - 1][ko]) % mod;
      } else {
        dp[i][ko] =
            (dp[i][ko - 1] + dp[i - 1][ko] - dp[i - 1][ko - 1 - v[i - 1]]) %
            mod;
      }
    }
  }
  cout << dp[n][k];
  return 0;
  for (int i = (int)(0); i < (int)(n + 1); ++i) {
    for (int j = (int)(0); j < (int)(k + 1); ++j) {
      cout << dp[i][j] << ',';
    }
    cout << endl;
  }
}
