#include <bits/stdc++.h>
#pragma GCC optimize("03")
using namespace std;
constexpr int M = 1e9 + 7;
int main() {
  cin.tie(NULL);
  ios_base::sync_with_stdio(false);
  int n, k, a, dp[100008];
  cin >> n >> k;
  cin >> a;
  for (int i = 0; i <= a; ++i) dp[i] = 1;
  for (int i = 1; i < n; ++i) {
    int s = dp[0];
    for (int j = 1; j <= k; ++j) {
      s += dp[j];
      if (M <= s) s -= M;
      dp[j] = s;
    }
    cin >> a;
    for (int j = k; j > a; --j) {
      s = dp[j] - dp[j - a - 1];
      if (s < 0) s += M;
      dp[j] = s;
    }
  }
  cout << dp[k] << "\n";
  return 0;
}
