#include <bits/stdc++.h>
using ll = long long;
const ll N = 2 * 1e5 + 5;
const ll mod = 1e9 + 7;
const ll inf = 1e18;
const ll SZ = 101;
const double eps = 1e-9;
using namespace std;
ll dp[100][2 * 100 * 1000 + 5] = {};
void solve() {
  ll n, k;
  scanf("%lld%lld", &n, &k);
  vector<ll> a(n);
  for (auto &it : a) scanf("%lld", &it);
  dp[0][0] = 1;
  for (ll i = 0; i < n; ++i) {
    for (ll cur = 0; cur <= k; ++cur) {
      dp[i + 1][cur] += dp[i][cur];
      dp[i + 1][cur] %= mod;
      dp[i + 1][cur + a[i] + 1] -= dp[i][cur];
      dp[i + 1][cur + a[i] + 1] %= mod;
      if (dp[i + 1][cur + a[i] + 1] < 0) dp[i + 1][cur + a[i] + 1] += mod;
    }
    for (ll cur = 1; cur <= k; ++cur)
      dp[i + 1][cur] += dp[i + 1][cur - 1], dp[i + 1][cur] %= mod;
  }
  cout << dp[n][k];
}
int32_t main(int32_t argc, char *argv[]) {
  double t1 = clock();
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ll TC = 1, t = 0;
  while (t++ < TC) {
    solve();
  }
  if (false)
    cerr << "Time : " << 1000 * (clock() - t1) / CLOCKS_PER_SEC << " ms\n";
  return 0;
}
