#include <bits/stdc++.h>
using namespace std;
long long n, k;
long long a[101];
long long dp[102][100005] = {0};
const int mod = 1e9 + 7;
long long add(long long x, long long y) { return (x + y + mod) % mod; }
int main() {
  cin >> n >> k;
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 0; i <= a[0] and i <= k; i++) dp[0][i] = 1LL;
  for (long long i = 1; i < n; i++) {
    vector<long long> pref(k + 1, 0);
    pref[0] = dp[i - 1][0];
    for (long long j = 1; j <= k; j++) pref[j] = add(dp[i - 1][j], pref[j - 1]);
    for (long long j = 0; j <= k; j++)
      if (j > a[i])
        dp[i][j] = add(dp[i - 1][j], pref[j] - pref[j - a[i] - 1]);
      else
        dp[i][j] = add(dp[i - 1][j], (j > 0 ? pref[j - 1] : 0));
  }
  cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC
       << "ms\n";
  cout << dp[n - 1][k];
}
