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