#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long dp[105][100005];
int a[105];
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) dp[i][0] = 1;
  for (int i = 1; i <= k; i++) dp[0][i] += dp[0][i - 1];
  for (int i = 0; i < n; i++) {
    for (int j = 1; j <= k; j++) {
      dp[i + 1][j] = dp[i + 1][j - 1] + dp[i][j];
      if (j - a[i] - 1 >= 0) {
        dp[i + 1][j] -= dp[i][j - a[i] - 1];
      }
    }
  }
  if (k == 0)
    cout << 1 << endl;
  else {
    cout << (dp[n][k] - dp[n][k - 1]) % mod << endl;
  }
}
