#include <bits/stdc++.h>
using namespace std;
int MOD = 1e9 + 7;
int dp[104][100009];
int a[104], pre[104][100009];
inline int add(int a, int b) {
  a += b;
  if (a >= MOD) a -= MOD;
  return a;
}
inline int sub(int a, int b) {
  a -= b;
  if (a < 0) a += MOD;
  return a;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (int i = 0; i < n; ++i) pre[i][0] = dp[i][0] = 1;
  for (int i = 0; i <= k; ++i) {
    dp[0][i] = 1 * (i <= a[0]);
    if (i > 0)
      pre[0][i] = pre[0][i - 1] + dp[0][i];
    else
      pre[0][0] = 1;
  }
  for (int i = 1; i < n; ++i) {
    for (int j = 1; j <= k; ++j) {
      if (j - a[i] - 1 < 0) {
        dp[i][j] = pre[i - 1][j] % MOD;
      } else {
        dp[i][j] = (pre[i - 1][j] % MOD - pre[i - 1][j - a[i] - 1] % MOD) % MOD;
      }
      pre[i][j] = (pre[i][j - 1] % MOD + dp[i][j] % MOD) % MOD;
      pre[i][j] %= MOD;
    }
  }
  cout << dp[n - 1][k];
  return 0;
}
