#include <bits/stdc++.h>
using namespace std;
template <typename T>
T mod_sub(T a, T b, T m);
int main() {
  uint64_t mod = pow(10, 9) + 7;
  uint32_t N, K;
  cin >> N >> K;
  vector<uint32_t> a(N);
  for (uint32_t i = 0; i < N; i++) cin >> a[i];
  vector<vector<uint64_t>> dp(N, vector<uint64_t>(K + 1));
  for (uint32_t j = 0; j <= K && j <= a[0]; j++) dp[0][j] = 1;
  for (uint32_t i = 1; i < N; i++) {
    uint64_t tsm = 0;
    for (uint32_t j = 0; j <= K; j++) {
      tsm = (tsm + dp[i - 1][j]) % mod;
      if (j > a[i]) tsm = mod_sub(tsm, dp[i - 1][j - a[i]], mod);
      if (tsm == 0) break;
      dp[i][j] = tsm;
    }
  }
  cout << dp[N - 1][K];
  return 0;
}
template <typename T>
T mod_sub(T a, T b, T m) {
  return (a > b) ? (a - b) % m : m + a - b;
}
