#include <bits/stdc++.h>
using namespace std;
const long long INF = LONG_LONG_MAX;
const double PI = atan(1) * 4;
const int MAXN = 1e5 + 20;
const double EPS = 1e-10;
const int MOD = 1e9 + 7;
int n, k, dp[101][MAXN];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cout << setprecision(2) << fixed;
  cin >> n >> k;
  int arr[n];
  for (int i = 0; i < (int)n; ++i) {
    cin >> arr[i];
  }
  for (int i = 0; i < (int)arr[0] + 1; ++i) {
    dp[1][i] = 1;
  }
  for (int i = (int)2; i <= (int)n; ++i) {
    for (int j = 0; j < (int)k + 1; ++j) {
      if (j == 0) {
        dp[i][j] = dp[i - 1][j] % MOD;
      } else if (j < arr[i]) {
        dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % MOD;
      } else {
        dp[i][j] =
            (dp[i - 1][j] + dp[i][j - 1] - dp[i - 1][j - arr[i] - 1]) % MOD;
      }
    }
  }
  cout << dp[n][k] % MOD << '\n';
}
