#include <bits/stdc++.h>
using namespace std;
const int N = 102, K = 1e5 + 2, mod = 1e9 + 7;
int ai[N], dp[N][K];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  if (k == 0) {
    cout << 0;
    return 0;
  }
  for (int i = 1; i <= n; ++i) cin >> ai[i];
  for (int i = 0; i <= k; ++i) dp[0][i] = 1;
  for (int i = 0; i <= n; ++i) dp[i][0] = 1;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= k; ++j) {
      int x = ((long long)(dp[i - 1][j] -
                           ((j - ai[i] > 0) ? dp[i - 1][j - ai[i] - 1] : 0) +
                           mod)) %
              mod;
      dp[i][j] = ((long long)(dp[i][j - 1] + x)) % mod;
    }
  }
  cout << (dp[n][k] - dp[n][k - 1] + mod) % mod;
  return 0;
}
