#include <bits/stdc++.h>
using ll = long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 50;
constexpr double pi = 3.14159265358979;
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
using namespace std;
ll dp[105][10005];
void solve() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i = (int)0; i < (int)n; ++i) cin >> a[i];
  dp[0][0] = 1;
  vector<ll> sum(k + 5, 0);
  for (int i = (int)0; i < (int)n; ++i) {
    sum[0] = 0;
    for (int j = 1; j <= k + 1; ++j) {
      sum[j] = (sum[j - 1] + dp[i][j - 1]) % mod;
    }
    for (int j = (int)0; j < (int)k + 1; ++j)
      dp[i + 1][j] = (sum[j + 1] - sum[max(0, j - a[i])]) % mod;
  }
  cout << dp[n][k] << "\n";
}
signed main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  solve();
  return 0;
}
