#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
const int N = 1e2 + 9;
const int K = 1e5 + 9;
const ll MOD = 1e9 + 7;
int n, k;
int a[K];
ll dp[N][K];
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  fill(dp[0], dp[N], 1);
  fill(dp[0], dp[1], 0);
  dp[0][0] = 1;
  for (int ch = 1; ch <= n; ch++) {
    for (int ca = 1; ca <= k; ca++) {
      dp[ch][ca] = dp[ch - 1][ca] + dp[ch][ca - 1];
      if (ca - a[ch] - 1 >= 0) dp[ch][ca] -= dp[ch - 1][ca - a[ch] - 1];
      dp[ch][ca] %= MOD;
    }
  }
  cout << dp[n][k] << endl;
}
