#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
long long dp[105][200005];
long long mod = 1e9 + 7;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  clock_t clk;
  clk = clock();
  long long n, k;
  cin >> n >> k;
  long long a[n + 1];
  for (long long i = 1; i <= n; i++) cin >> a[i];
  dp[0][0] = 1;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 0; j <= k; j++) {
      dp[i][j] = (dp[i][j] + dp[i - 1][j] + mod) % mod;
      dp[i][j + a[i] + 1] = (dp[i][j + a[i] + 1] + mod - dp[i - 1][j]);
    }
    for (long long j = 1; j <= k; j++) {
      dp[i][j] += dp[i][j - 1];
      dp[i][j] %= mod;
    }
  }
  cout << dp[n][k];
  clk = clock() - clk;
  cerr << fixed << setprecision(6) << "Time: " << ((double)clk) / CLOCKS_PER_SEC
       << "\n";
  return 0;
}
