#include <bits/stdc++.h>
using namespace std;
long long int n, arr[105];
long long int dp[105][100005], dpsum[105][100005];
long long int answerit(long long int xxx, long long int k) {
  long long int i, j;
  for (j = 1; j <= k; j++) {
    dp[n][j] = 0;
    dpsum[n][j] = 1;
  }
  for (i = 0; i <= n; i++) {
    dp[i][0] = dpsum[i][0] = 1;
  }
  for (j = 1; j <= k; j++) {
    for (i = n - 1; i >= 0; i--) {
      long long int mn = j - arr[i] - 1;
      dp[i][j] = dpsum[i + 1][j];
      if (mn >= 0) dp[i][j] -= dpsum[i + 1][mn];
      dpsum[i][j] = (dpsum[i][j - 1] + dp[i][j]) % 1000000007;
    }
  }
  return dp[0][k];
}
void solve(long long int caseno) {
  long long int i, j, k, ans;
  cin >> n >> k;
  for (i = 0; i < n; i++) cin >> arr[i];
  memset(dp, -1, sizeof(dp));
  ans = answerit(0, k);
  cout << ans << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int t = 1;
  for (long long int i = 1; i <= t; i++) {
    solve(i);
  }
  return 0;
}
