#include <bits/stdc++.h>
const long long mxn = 1e5 + 7;
const long long mod = 1e7 + 7;
const long long inf = 1e18 + 9;
using namespace std;
long long n, a[mxn], k, dp[101][mxn], sum2, sum1, dp2[101][mxn];
bool ok = 0;
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      dp[i][j] = dp[i - 1][j];
      if (j != 0) {
        dp[i][j] = dp[i][j] + dp[i][j - 1];
        dp[i][j] %= mod;
      }
      if (j > a[i]) {
        dp[i][j] = dp[i][j] - dp[i - 1][j - a[i] - 1];
        dp[i][j] += mod;
        dp[i][j] %= mod;
      }
    }
  }
  cout << dp[n][k];
  return 0;
}
