#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long n, k;
  vector<vector<long long>> dp(101, vector<long long>(100001, 0));
  vector<vector<long long>> dsum(101, vector<long long>(100001, 0));
  cin >> n >> k;
  long long a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    dp[i][0] = 1;
  }
  dp[n][0] = 1;
  fill(dsum[0].begin(), dsum[0].end(), 1);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= k; j++) {
      if (j - a[i] > 0) {
        dp[i + 1][j] = dsum[i][j] - dsum[i][j - a[i] - 1];
      } else {
        dp[i + 1][j] = dsum[i][j];
      }
      dp[i + 1][j] %= 1000000007;
    }
    dsum[i + 1][0] = dp[i + 1][0];
    for (int j = 1; j <= k; j++) {
      dsum[i + 1][j] += dsum[i + 1][j - 1] + dp[i + 1][j];
      dsum[i + 1][j] %= 1000000007;
    }
  }
  cout << dp[n][k] % 1000000007 << endl;
}
