#include <bits/stdc++.h>
using namespace std;
long long dp[101][100001];
long long topDown(vector<long long> &arr, long long index, long long k) {
  if (k == 0) return 1LL;
  if (index < 0) return 0LL;
  if (dp[index][k] >= 0) return dp[index][k];
  long long ways = 0;
  for (long long i = min(arr[index], k); i >= 0; i--) {
    ways += topDown(arr, index - 1, k - i) % 1000000007;
    ways %= 1000000007;
  }
  dp[index][k] = ways;
  return ways;
}
void solve() {
  long long n, k;
  cin >> n >> k;
  vector<long long> arr(n), cnt(n + 1, 0);
  for (auto &i : arr) cin >> i;
  memset(dp, 0, sizeof(dp));
  dp[0][0] = 1;
  for (int i = 1; i <= k; i++) dp[0][i] += dp[0][i - 1];
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      if (j - arr[i - 1] > 0) {
        dp[i][j] = ((dp[i - 1][j] % 1000000007 -
                     dp[i - 1][j - arr[i - 1] - 1] % 1000000007) +
                    1000000007) %
                   1000000007;
        dp[i][j] %= 1000000007;
      } else
        dp[i][j] = dp[i - 1][j] % 1000000007;
    }
    for (int j = 1; j <= k; j++) {
      dp[i][j] += dp[i][j - 1];
      dp[i][j] %= 1000000007;
    }
  }
  cout << dp[n][k] - dp[n][k - 1] << endl;
  ;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
