#include <bits/stdc++.h>
using namespace std;
const int N = 105;
const int K = 1e5 + 5;
const int mod = 1e9 + 7;
int cld[N];
int dp[N][K];
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> cld[i];
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) dp[i][0] = 1;
  for (int j = 1; j <= k; j++) dp[0][j] = 0;
  for (int i = 1; i <= n; i++) {
    int sums[k + 1];
    sums[0] = 1;
    for (int j = 1; j <= k; j++) {
      sums[j] = (dp[i - 1][j] + sums[j - 1]) % mod;
      int tmp = sums[j];
      int unreachable = j - cld[i] - 1;
      if (unreachable >= 0) tmp = (tmp - sums[unreachable]) % mod;
      dp[i][j] = tmp;
    }
  }
  cout << dp[n][k];
  return 0;
}
