#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << endl;
  err(++it, args...);
}
const long long N = 1e5 + 1, inf = 2e9 + 7, mod = 1e9 + 7;
const long long INF = 2e18 + 7, MOD = 1e15 + 7;
long long a[101];
long long dp[101][N], pref[101][N];
long long add(long long a, long long b) {
  if (a + b >= mod) return (a + b) - mod;
  return a + b;
}
long long sub(long long a, long long b) {
  if (a - b < 0) return a - b + mod;
  return a - b;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, k;
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (long long i = 0; i <= a[1]; i++) dp[1][i] = 1;
  for (long long i = 0; i <= k; i++) {
    if (i) {
      pref[1][i] = pref[1][i - 1] + dp[1][i];
    } else
      pref[1][i] = dp[1][i];
  }
  for (long long i = 2; i <= n; i++) {
    for (long long j = 0; j <= k; j++) {
      if (j - a[i] - 1 < 0) {
        dp[i][j] = pref[i - 1][j];
      } else
        dp[i][j] = sub(pref[i - 1][j], pref[i - 1][j - a[i] - 1]);
    }
    for (long long j = 0; j <= k; j++) {
      if (!j) pref[i][j] = dp[i][j];
      pref[i][j] = add(pref[i][j - 1], dp[i][j]);
    }
  }
  cout << dp[n][k];
  return 0;
}
