#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
T max(T x, U y) {
  return x > y ? x : y;
}
template <typename T, typename U>
T min(T x, U y) {
  return x < y ? x : y;
}
long long dp[101][100001];
long long dp1[101][100001];
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, k;
  cin >> n >> k;
  long long a[n];
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (int i = 0; i <= n; ++i) {
    for (int j = 0; j <= k; ++j) {
      if (i == 0 and j == 0) {
        dp[i][j] = 1;
        dp1[i][j] = 1;
      } else if (i == 0) {
        dp[i][j] = 0;
        dp1[i][j] = dp1[i][j - 1] + dp[i][j];
        dp1[i][j] %= 1000000007;
      } else if (j == 0) {
        dp[i][j] = 1;
        dp1[i][j] = 1;
      } else {
        if (j - a[i - 1] - 1 < 0)
          dp[i][j] += dp1[i - 1][j];
        else
          dp[i][j] += dp1[i - 1][j] - dp1[i - 1][j - a[i - 1] - 1];
        dp1[i][j] = dp1[i][j - 1] + dp[i][j];
        dp[i][j] %= 1000000007;
        dp1[i][j] %= 1000000007;
      }
    }
  }
  cout << dp[n][k];
}
