#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 6;
const long long M = 1e9 + 7;
const long long inf = 1e17;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  if (0) return;
  cout << name << " : " << arg1 << "\n";
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  if (0) return;
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
long long A[N];
long long n, a, b;
long long dp[101][N];
long long alpha(long long i, long long k) {
  if (i == 0 && k == 0) return 1;
  if (i <= 0) return 0;
  long long& abstergo = dp[i][k];
  if (abstergo != -1) return abstergo;
  long long ans = 0;
  ans += alpha(i - 1, k), ans %= M;
  if (k - 1 >= 0) ans += alpha(i, k - 1), ans %= M;
  if (k - 1 >= A[i]) ans -= alpha(i - 1, k - 1 - A[i]), ans %= M;
  return abstergo = ans;
}
void solve() {
  cin >> n >> a;
  for (long long i = 1; i < n + 1; i++) cin >> A[i];
  memset(dp, -1, sizeof(dp));
  cout << alpha(n, a);
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  while (t--) solve();
}
