#include <bits/stdc++.h>
using namespace std;
const long long N = 123456;
const long long mod = 1e9 + 7;
const long double eps = 1e-5;
int a[N];
int dp[123][N];
int pre[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << fixed;
  int n, k;
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  for (long long i = 1; i <= n; i++) {
    dp[i][0] = 1;
  }
  for (long long j = 0; j <= k; j++) {
    if (j <= a[1]) {
      dp[1][j] = 1;
      pre[j] = 1;
    }
  }
  for (long long i = 1; i <= k; i++) {
    pre[i] += pre[i - 1];
    pre[i] %= mod;
  }
  for (long long i = 2; i <= n; i++) {
    for (long long j = 1; j <= k; j++) {
      int end = max(0, (int)j - (int)a[i]);
      if (end == 0) {
        dp[i][j] = pre[j];
        dp[i][j] %= mod;
      } else {
        dp[i][j] = pre[j] - pre[end - 1];
        dp[i][j] %= mod;
      }
    }
    for (long long j = 0; j <= k; j++) {
      pre[j] = dp[i][j];
      pre[j] %= mod;
    }
    for (long long j = 1; j <= k; j++) {
      pre[j] += pre[j - 1];
      pre[j] %= mod;
    }
  }
  cout << dp[n][k] << endl;
  return 0;
}
