#include <bits/stdc++.h>
using namespace std;
const long long modp = 1e+9 + 7;
long long n, k, a[110] = {0};
long long dp[110][100010] = {0};
signed main() {
  cin >> n >> k;
  for (long long i = (0); i < (n); ++i) {
    cin >> a[i + 1];
  }
  dp[0][0] = 1;
  for (long long i = (0); i < (n + 1); ++i) {
    for (long long j = (0); j < (k + 1); ++j) {
      if (i == 0 && j == 0) {
        continue;
      }
      if (i >= 1) {
        dp[i][j] += dp[i - 1][j];
        dp[i][j] %= modp;
        if (j - a[i] - 1 >= 0) {
          dp[i][j] += modp;
          dp[i][j] -= dp[i - 1][j - a[i] - 1];
          dp[i][j] %= modp;
        }
      }
      if (j >= 1) {
        dp[i][j] += dp[i][j - 1];
        dp[i][j] %= modp;
      }
    }
  }
  cout << dp[n][k] - dp[n][k - 1] << endl;
  return 0;
}
