#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
using ll = long long;
ll dp[105][100005];
int main() {
  ll N, K;
  cin >> N >> K;
  vector<ll> v(N);
  for (ll i = 0LL; i < N; i++) {
    cin >> v.at(i);
  }
  for (ll i = 0LL; i <= v.at(0); i++) {
    dp[0][i] = 1LL;
  }
  for (ll i = 1LL; i < N; i++) {
    for (ll j = 0LL; j <= K; j++) {
      if (j == 0)
        dp[i][j] = 1;
      else if (j <= v.at(i)) {
        dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % 1000000007;
      } else {
        dp[i][j] = (dp[i - 1][j] + dp[i][j - 1] - dp[i - 1][j - v.at(i) - 1]) %
                   1000000007;
      }
    }
  }
  cout << dp[N - 1][K] << endl;
}
