#include <bits/stdc++.h>
using namespace std;
int main() {
  long long mod = 1000000007;
  ios_base::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  long long arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  static long long dp[100][100001];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= k; j++) {
      dp[i][j] = -1;
    }
  }
  for (int i = 0; i <= arr[0]; i++) {
    dp[0][i] = 1ll;
  }
  for (int i = 1; i < n; i++) {
    for (int j = 1; j <= k; j++) {
      if (dp[i - 1][j] == -1) break;
      dp[i - 1][j] += dp[i - 1][j - 1];
      dp[i - 1][j] %= mod;
    }
    for (int j = 0; j <= k; j++) {
      int l = max(0ll, j - arr[i]);
      int r = j;
      long long ans = dp[i - 1][r];
      if (l != 0) ans -= dp[i - 1][l];
      ans += mod;
      ans %= mod;
      dp[i][j] = ans;
    }
  }
  cout << dp[n - 1][k];
  return 0;
}
