#include <bits/stdc++.h>
using namespace std;
long long n, k;
long long a[109];
long long dp[100009];
long long upd[100009];
long long mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n >> k;
  for (int i = 0; i < n; ++i) cin >> a[i];
  dp[0] = 1;
  for (int i = 0; i < n; ++i) {
    for (int j = k; j >= 0; --j) {
      upd[j + 1] += dp[j];
      upd[j + 1] %= mod;
      if (j + a[i] + 1 <= k) {
        upd[j + a[i] + 1] -= dp[i];
        upd[j + a[i] + 1] %= mod;
        if (upd[j + a[i] + 1] < 0) upd[j + a[i] + 1] += mod;
      }
    }
    for (int j = 1; j <= k; ++j) {
      upd[j] += upd[j - 1];
      upd[j] %= mod;
      dp[j] += upd[j];
      dp[j] %= mod;
    }
    for (int j = 1; j <= k; ++j) upd[j] = 0;
  }
  cout << dp[k] << "\n";
}
