#include <bits/stdc++.h>
using namespace std;
int dp[101][100001];
int N, K;
int IN;
vector<int> A;
int MOD = (int)1e9 + 7;
int solve(int n, int k) {
  if (dp[n][k] != -1) {
    return dp[n][k];
  }
  if (k == 0) {
    return 1;
  }
  if (n == N) {
    return 0;
  }
  int total = 0;
  for (int b = 0; b < min(k + 1, A[n] + 1); b++) {
    total += solve(n + 1, k - b);
    total %= MOD;
  }
  dp[n][k] = total;
  return total;
}
int main() {
  cin >> N >> K;
  for (int i = 0; i < N; i++) {
    cin >> IN;
    A.push_back(IN);
  }
  for (int i = 0; i < 101; i++) {
    for (int j = 0; j < 100001; j++) {
      dp[i][j] = -1;
    }
  }
  vector<int> dp_prev(K + 1, 0);
  vector<int> dp_(K + 1, 0);
  dp_prev[0] = 1;
  for (int n = N - 1; n >= 0; n--) {
    fill(dp_.begin(), dp_.end(), 0);
    vector<int> csum(K + 1, 0);
    csum[0] = dp_prev[0];
    for (int i = 1; i < K + 1; i++) {
      csum[i] = (csum[i - 1] + dp_prev[i]) % MOD;
    }
    for (int k = 0; k <= K; k++) {
      if (k == 0) {
        dp_[k] = 1;
      } else {
        dp_[k] = csum[k] -
                 (k - min(k, A[n]) - 1 >= 0 ? csum[k - min(k, A[n]) - 1] : 0);
      }
    }
    dp_prev = dp_;
  }
  cout << dp_prev[K] << endl;
}
