#include <bits/stdc++.h>
using namespace std;
const int maxn = 101, maxk = 100100, mod = 1e9 + 7;
long long dp[maxn][maxk], a[maxn];
int n, k;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i <= min(a[0], (long long)k); ++i) dp[0][i] = 1;
  for (int i = 1; i < n; ++i) {
    for (int j = 1; j <= k; ++j)
      dp[i - 1][j] = (dp[i - 1][j] + dp[i - 1][j - 1]) % mod;
    for (int j = 0; j <= k; ++j) {
      int lo = max(0LL, (long long)j - a[i]);
      int hi = j;
      dp[i][j] = dp[i - 1][hi] - (lo > 0 ? dp[i - 1][lo - 1] : 0);
      dp[i][j] %= mod;
    }
  }
  cout << dp[n - 1][k] << '\n';
  return 0;
}
