#include <bits/stdc++.h>
using namespace std;
int dp[102][100004];
int pref[102][100004];
int main() {
  ios::sync_with_stdio(false);
  int n, k;
  int a[102];
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  int mod = 1e9 + 7;
  memset(dp, 0, sizeof dp);
  memset(pref, 0, sizeof pref);
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    pref[i - 1][0] = dp[i - 1][0];
    for (int j = 1; j <= k; j++) {
      pref[i - 1][j] = (dp[i - 1][j] + pref[i - 1][j - 1]);
    }
    for (int j = 0; j <= k; j++) {
      if (j - a[i] - 1 >= 0)
        dp[i][j] = (pref[i - 1][j] - pref[i - 1][j - a[i] - 1]) % mod;
      else
        dp[i][j] = pref[i - 1][j] % mod;
    }
  }
  cout << dp[n][k] % mod << endl;
  return 0;
}
