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