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