#include <bits/stdc++.h>
using namespace std;
long long dp[101][100001];
long long mod = 1e9 + 7;
int main() {
  int n, k, A[200001];
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> A[i];
  fill(dp[0], dp[0] + k + 1, 0);
  dp[0][0] = 1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < k; j++) (dp[i][j + 1] += dp[i][j]) %= mod;
    for (int j = 0; j < k + 1; j++)
      dp[i + 1][j] =
          (dp[i][j] - dp[i][j - A[i] - 1] * (j - A[i] - 1 >= 0) + mod) % mod;
  }
  cout << dp[n][k] << "\n";
}
