#include <bits/stdc++.h>
using namespace std;
long long dp[102][100005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long n, k;
  long long mod = 1e9 + 7;
  cin >> n >> k;
  vector<long long> a(n + 1);
  for (long long i = 1; i <= n; i++) cin >> a[i];
  for (long long j = 0; j <= k; j++) dp[1][j] = (j > a[1]) ? 0 : 1;
  for (long long i = 2; i <= n; i++) {
    for (long long j = 0; j <= k; j++) {
      if (j == 0) {
        dp[i][j] = dp[i - 1][j];
      } else {
        dp[i][j] = dp[i][j - 1] + dp[i - 1][j] -
                   ((j - i - a[i]) >= 0 ? dp[i][j - 1 - a[i]] : 0);
        dp[i][j] = (mod + dp[i][j]) % mod;
      }
    }
  }
  cout << dp[n][k] << '\n';
  return 0;
}
