#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  std::cerr << name << " : " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  std::cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
long long dp[101][100005];
signed main() {
  ios_base::sync_with_stdio(0);
  long long TESTS = 1;
  while (TESTS--) {
    long long n, k;
    cin >> n >> k;
    long long a[n + 1];
    for (long long i = 1; i < n + 1; i++) cin >> a[i];
    for (long long i = 0; i < n + 1; i++) {
      for (long long j = 0; j < 100005; j++) dp[i][j] = 0;
    }
    for (long long i = 0; i < 100005; i++) dp[1][i] = min(a[1] + 1, i + 1);
    for (long long i = 2; i < n + 1; i++) {
      for (long long j = 0; j < 100005; j++) {
        dp[i][j] = ((j > 0) * dp[i][j - 1] + dp[i - 1][j] -
                    (j >= a[i] + 1) * dp[i - 1][j - a[i] - 1] + 1000000007) %
                   1000000007;
      }
    }
    if (k != 0)
      cout << dp[n][k] - dp[n][k - 1];
    else
      cout << dp[n][k];
  }
}
