#include <bits/stdc++.h>
using namespace std;
long long dp[101][100001];
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i <= n; i++) {
    dp[i][0] = 1;
  }
  vector<long long> prefix_sum(k + 1);
  for (int j = 0; j <= k; j++) {
    if (j <= a[n - 1])
      dp[n - 1][j] = 1;
    else
      dp[n - 1][j] = 0;
    if (j > 0)
      prefix_sum[j] = prefix_sum[j - 1] + dp[n - 1][j];
    else
      prefix_sum[j] = dp[n - 1][j];
    if (prefix_sum[j] > (int)(1e9 + 7)) {
      prefix_sum[j] -= (int)(1e9 + 7);
    }
  }
  for (int i = n - 2; i >= 0; i--) {
    vector<long long> new_prefix_sum(k + 1);
    for (int j = 0; j <= k; j++) {
      dp[i][j] = 0;
      if (j >= a[i] + 1)
        dp[i][j] += prefix_sum[j] - prefix_sum[j - a[i] - 1];
      else
        dp[i][j] = prefix_sum[j];
      if (dp[i][j] > (int)(1e9 + 7)) dp[i][j] -= (int)(1e9 + 7);
      if (j > 0)
        new_prefix_sum[j] = new_prefix_sum[j - 1] + dp[i][j];
      else
        new_prefix_sum[j] = dp[i][j];
      if (new_prefix_sum[j] > (int)(1e9 + 7)) {
        new_prefix_sum[j] -= (int)(1e9 + 7);
      }
    }
    prefix_sum = new_prefix_sum;
  }
  cout << dp[0][k] << endl;
}
