#include <bits/stdc++.h>
using namespace std;
const int sz = 1e5 + 1;
const int MOD = 1e9 + 7;
long long int dp[101][sz];
long long int prefix[1][sz];
long long int solve(vector<long long int>& thresholds, long long int n,
                    long long int k) {
  for (int i = 0; i <= thresholds[1] && i <= k; ++i) dp[1][i] = 1;
  prefix[0][0] = dp[1][0];
  for (int i = 1; i <= k; ++i) {
    prefix[0][i] = (prefix[0][i - 1] + dp[1][i]) % MOD;
  }
  for (int i = 1; i <= n; ++i) dp[i][0] = 1;
  for (int i = 2; i <= n; ++i) {
    int t = thresholds[i];
    for (int j = 1; j <= k; ++j) {
      int l = max(0, j - t);
      dp[i][j] =
          (l >= 1) ? (prefix[0][j] - prefix[0][l - 1]) % MOD : prefix[0][j];
    }
    prefix[0][0] = dp[i - 1][0];
    for (int m = 1; m <= k; ++m) {
      prefix[0][m] = (prefix[0][m - 1] + dp[i][m]) % MOD;
    }
  }
  return dp[n][k];
}
int main() {
  for (long long int i = 0; i < 101; ++i) {
    for (long long int j = 0; j < sz; ++j) {
      dp[i][j] = 0;
    }
  }
  for (int i = 0; i < sz; ++i) dp[0][i] = 0;
  long long int n = 0;
  cin >> n;
  long long int k = 0;
  cin >> k;
  vector<long long int> threshold(n + 1, 0);
  long long int total_possible = 0;
  for (int i = 1; i <= n; ++i) {
    cin >> threshold[i];
  }
  cout << solve(threshold, n, k) % MOD << endl;
  return 0;
}
