#include <bits/stdc++.h>
using namespace std;
int main() {
  long long mod = 1000000007;
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, k;
  cin >> n >> k;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long dp[100001][101];
  memset(dp, 0, sizeof(dp));
  for (int i = 0; i < n; i++) {
    dp[0][i] = 1;
  }
  for (int i = 1; i <= a[0]; i++) {
    dp[i][0] = dp[i - 1][0] + 1;
  }
  for (int i = a[0] + 1; i <= k; i++) {
    dp[i][0] = dp[i - 1][0];
  }
  for (int j = 1; j < n; j++) {
    for (int i = 1; i <= k; i++) {
      long long diff = dp[i][j - 1];
      if (a[j] < i) {
        diff = (dp[i][j - 1] - dp[i - a[j] - 1][j - 1]) % mod;
      }
      dp[i][j] = (dp[i - 1][j] + diff) % mod;
    }
  }
  long long ans = dp[k][n - 1];
  if (k > 1) ans = (ans - dp[k - 1][n - 1]) % mod;
  cout << ans << endl;
  return 0;
}
