#include <bits/stdc++.h>
const int MOD = 1e9 + 7;
using namespace std;
long long n, k, dp[3][100005], a[105], sum[100005], nextSum[100005];
void read() {
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
}
void solve() {
  dp[0][0] = dp[1][0] = dp[2][0] = 1;
  sum[0] = 1;
  nextSum[0] = 1;
  for (long long j = 1; j <= k; ++j) {
    dp[1][j] = ((j <= a[1]) ? 1 : 0);
    sum[j] = (sum[j - 1] + dp[1][j]) % MOD;
  }
  for (long long nr = 2; nr <= n; ++nr) {
    long long pos = (nr % 2) ? 1 : 2;
    for (long long j = 1; j <= k; ++j) {
      if (j <= a[nr]) {
        dp[pos][j] = sum[j];
      } else {
        dp[pos][j] = sum[j] - sum[j - a[nr] - 1];
      }
      nextSum[j] = (nextSum[j - 1] + dp[pos][j]) % MOD;
    }
    for (int j = 0; j <= k; ++j) {
      sum[j] = nextSum[j];
    }
  }
  cout << dp[(n % 2) ? 1 : 2][k] << "\n";
}
int main() {
  read();
  solve();
  return 0;
}
