#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
std::istream& operator>>(std::istream& in, pair<T1, T2>& a) {
  in >> a.first >> a.second;
  return in;
}
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& out, pair<T1, T2>& a) {
  out << a.first << " " << a.second;
  return out;
}
long long a[105];
long long dp[105][100005];
void solve() {
  long long n, k;
  cin >> n >> k;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  if (k == 0) {
    cout << 1;
    return;
  }
  for (long long j = 0; j < a[0] + 1; j++) {
    dp[0][j] = 1;
  }
  for (long long j = 1; j < k + 1; j++) {
    dp[0][j] += dp[0][j - 1];
    dp[0][j] %= 1000000007;
  }
  for (long long i = 1; i < n; i++) {
    for (long long j = 0; j < k + 1; j++) {
      dp[i][j] = dp[i - 1][j];
      if (j > a[i]) dp[i][j] += 1000000007 - dp[i - 1][j - a[i] - 1];
      dp[i][j] %= 1000000007;
    }
    for (long long j = 1; j < k + 1; j++) {
      dp[i][j] += dp[i][j - 1];
      dp[i][j] %= 1000000007;
    }
  }
  cout << dp[n - 1][k] - dp[n - 1][k - 1];
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) solve();
  return 0;
}
