#include <bits/stdc++.h>
using namespace std;
const long long md = (1e+9) + 7;
int a[100];
long long dp[101][100001] = {0};
int main() {
  int n;
  int k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i <= k; i++) {
    dp[0][i] = i + 1;
    if (i > a[0]) {
      dp[0][i] = a[0] + 1;
    }
    dp[0][i] %= md;
  }
  for (int i = 1; i < n; i++) {
    dp[i][0] = 1;
    for (int j = 1; j <= k; j++) {
      dp[i][j] = dp[i][j - 1];
      dp[i][j] += dp[i - 1][j];
      if (j > a[i]) {
        dp[i][j] -= dp[i - 1][j - a[i] - 1];
      }
      dp[i][j] %= md;
    }
  }
  cout << (dp[n - 1][k] - dp[n - 1][k - 1]);
  return 0;
}
