#include <bits/stdc++.h>
using namespace std;
constexpr long long MOD = 1e9 + 7;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, k, a[112345];
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i + 1];
  static long long dp[101][100010];
  memset(dp, 0, sizeof(dp));
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    dp[i][0] = 1;
    for (int j = 1; j <= k; j++) {
      if (j - a[i] - 1 >= 0)
        dp[i][j] = dp[i - 1][j] + dp[i][j - 1] - dp[i - 1][j - a[i] - 1];
      else
        dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
      dp[i][j] %= MOD;
    }
  }
  cout << dp[n][k] << endl;
  return 0;
}
