#include <bits/stdc++.h>
using namespace std;
const long long inf = 0x3f3f3f3f3f3f3f3f;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void zz() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); }
const long long mx = 1e5 + 5;
vector<long long> v(102, 0);
long long f(long long n, long long k) {
  vector<vector<long long> > dp(n + 2, vector<long long>(k + 2, 0));
  for (long long i = 0; i <= k; i++)
    if (i <= v[1]) dp[1][i] = 1;
  for (long long i = 2; i <= n; i++) {
    for (long long j = 0; j <= k; j++) {
      if (j == 0)
        dp[i][j] = dp[i - 1][j];
      else {
        dp[i][j] = (1000000007 + dp[i][j - 1] + dp[i - 1][j] -
                    (j - v[i] - 1 >= 0 ? dp[i - 1][j - v[i] - 1] : 0)) %
                   1000000007;
      }
    }
  }
  return dp[n][k];
}
int32_t main() {
  zz();
  long long n, k;
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) cin >> v[i];
  long long ans = f(n, k);
  cout << ans << endl;
}
