#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long n, k;
long long dp[101][100010];
long long pre[101][100010] = {{0}};
long long a[101] = {0};
void solve() {
  memset(dp, 0, sizeof(dp));
  cin >> n >> k;
  for (long long i = 1; i < n + 1; i++) {
    cin >> a[i];
  }
  for (long long i = 1; i < n + 1; i++) {
    dp[i][0] = 1;
    pre[i][0] = 1;
  }
  for (long long i = 0; i < k + 1; i++) {
    dp[1][i] = (i <= a[1]);
    pre[1][i] = dp[1][i];
  }
  for (long long i = 1; i < n + 1; i++) {
    for (long long j = 1; j < k + 1; j++) {
      pre[i][j] = pre[i][j - 1] + dp[i][j];
    }
  }
  for (long long i = 2; i <= n; i++) {
    for (long long j = 1; j <= k; j++) {
      long long l = min(a[i], j);
      dp[i][j] = (((pre[i - 1][j] % mod) - (pre[i - 1][j - l] % mod) % mod) +
                  dp[i - 1][j - l] % mod) %
                 mod;
      pre[i][j] = ((pre[i][j - 1] % mod) + (dp[i][j] % mod)) % mod;
    }
  }
  cout << dp[n][k] % mod << "\n";
}
int main() { solve(); }
