#include <bits/stdc++.h>
constexpr int kMod = 1000000007;
constexpr int kMaxChild = 101;
constexpr int kMaxCandy = 100001;
int main() {
  long long dp[kMaxChild][kMaxCandy];
  int N, K;
  std::cin >> N >> K;
  std::vector<int> a(N + 1);
  for (int i = 1; i <= N; ++i) std::cin >> a[i];
  dp[0][0] = 1;
  for (int k = 1; k <= K; ++k) dp[0][k] = 0;
  for (int n = 1; n <= N; ++n) {
    dp[n][0] = dp[n - 1][0];
    int k = 1;
    for (; k <= a[n] && k <= K; ++k) {
      dp[n][k] = dp[n - 1][k] + dp[n][k - 1];
      dp[n][k] %= kMod;
    }
    for (; k <= K; ++k) {
      dp[n][k] = dp[n - 1][k] + dp[n][k - 1] - dp[n - 1][k - a[n] - 1];
      dp[n][k] %= kMod;
    }
  }
  std::cout << dp[N][K] << std::endl;
}
