#include <bits/stdc++.h>
using namespace std;
const long long mod = (long long)(1e9 + 7);
long long dp[100001][101];
long long a[101];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout.precision(12);
  int n, k;
  cin >> n >> k;
  for (int i = 1; i < n + 1; ++i) {
    cin >> a[i];
  }
  dp[0][0] = 1;
  long long pref;
  for (int i = 1; i <= n; i++) {
    pref = 0;
    for (int j = 0; j <= k; j++) {
      pref += dp[i - 1][j];
      if (j > a[i]) pref -= dp[i - 1][j - a[i] - 1];
      pref %= mod;
      if (pref < 0) pref += mod;
      dp[i][j] = pref % mod;
    }
  }
  cout << dp[n][k] % mod << "\n";
  return 0;
}
