#include <bits/stdc++.h>
using namespace std;
const int inf = 1 << 30;
const long long linf = 1LL << 62;
const int MAX = 2100000;
long long dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
long long dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const double pi = acos(-1);
template <typename T1, typename T2>
inline void chmin(T1 &a, T2 b) {
  if (a > b) a = b;
}
template <typename T1, typename T2>
inline void chmax(T1 &a, T2 b) {
  if (a < b) a = b;
}
template <typename T1, typename T2>
inline void print2(T1 a, T2 b) {
  cout << a << " " << b << endl;
}
template <typename T1, typename T2, typename T3>
inline void print3(T1 a, T2 b, T3 c) {
  cout << a << " " << b << " " << c << endl;
}
const int mod = 1e9 + 7;
long long dp[105][100005];
int main() {
  long long n, k;
  cin >> n >> k;
  vector<long long> a(n);
  for (long long i = 0; i < (n); i++) cin >> a[i];
  for (long long j = 0; j < (k + 1); j++) dp[0][j] = 1;
  for (long long i = 0; i < (n); i++) {
    for (long long j = 0; j < (k + 1); j++) {
      long long c = 0;
      if (j - a[i] - 1 >= 0) c = dp[i][j - a[i] - 1];
      dp[i + 1][j] = dp[i][j] - c;
      if (dp[i + 1][j] < 0) dp[i + 1][j] += mod;
    }
    for (long long j = 0; j < (k); j++)
      dp[i + 1][j + 1] += dp[i + 1][j], dp[i + 1][j + 1] %= mod;
  }
  cout << dp[n][k] - dp[n][k - 1] << endl;
}
