#include <bits/stdc++.h>
namespace solver {
using namespace std;
int N, K, as[110];
long long dp[110][100010], sum[110][100010];
void init() {
  cin >> N >> K;
  for (int i = (int)(0); i < (int)((N)); i++) {
    cin >> as[i];
  }
}
void solve() {
  sum[N][0] = 0;
  for (int j = (int)(1); j <= (int)(K + 1); j++) sum[N][j] = 1;
  for (int i = (int)(N - 1); i >= (int)(0); i--) {
    for (int j = (int)(1); j <= (int)(K + 1); j++) {
      dp[i][j - 1] = sum[i + 1][j] - sum[i + 1][max(j - as[i] - 1, 0)];
      dp[i][j - 1] %= (1000000007);
    }
    for (int j = (int)(1); j <= (int)(K + 1); j++) {
      sum[i][j] = sum[i][j - 1] + dp[i][j - 1];
      sum[i][j] %= (1000000007);
    }
  }
  cout << dp[0][K] << "\n";
}
}  // namespace solver
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  solver::init();
  solver::solve();
  return 0;
}
