#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}
template <class T>
inline T sqr(T x) {
  return x * x;
}
const double EPS = 1e-10;
const double PI = acos(-1.0);
const long long INFL = 9223372036854775807LL / 10;
const int INFI = 2147483647 / 10;
int N, K;
int a[100];
const int limit_K = 1e5 + 1;
long long old_dp[limit_K];
long long dp[limit_K];
int mod = 1000000007;
int main() {
  ios::sync_with_stdio(false);
  cin >> N >> K;
  long long sums = 0;
  for (int i = (0); i < (N); ++i) {
    int aa;
    cin >> aa;
    a[i] = aa;
    sums += aa;
  }
  if (K > sums) {
    cout << 0 << endl;
    return 0;
  }
  for (int i = (0); i < (K + 1); ++i) {
    dp[i] = i <= a[0] ? 1 : 0;
  }
  for (int n = (1); n < (N); ++n) {
    memcpy(old_dp, dp, sizeof(dp));
    int sums[limit_K];
    sums[0] = old_dp[0];
    for (int k = (1); k < (K + 1); ++k) {
      sums[k] = (sums[k - 1] + old_dp[k]) % mod;
    }
    for (int k = (1); k < (K + 1); ++k) {
      int left = max(-1, k - (a[n] + 1));
      if (left == -1) {
        dp[k] = sums[k];
      } else {
        dp[k] = sums[k] - sums[left] % mod;
      }
    }
  }
  cout << dp[K] << endl;
}
