#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n, k, i, j, a[105];
  const int mod = 1e9 + 7;
  long long dp[105][100005] = {};
  cin >> n >> k;
  for (i = 1; i <= n; i++) cin >> a[i];
  for (j = 0; j <= k; j++) dp[0][j] = 1;
  for (i = 1; i <= n; i++) {
    for (j = 0; j <= k; j++) {
      if (j > a[i])
        dp[i][j] = (dp[i - 1][j] - dp[i - 1][j - a[i] - 1]) % mod;
      else
        dp[i][j] = dp[i - 1][j];
    }
    if (i < n) {
      for (j = 1; j <= k; j++) dp[i][j] = (dp[i][j] + dp[i][j - 1]) % mod;
    }
  }
  cout << dp[n][k] << endl;
  return 0;
}
