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