#include <bits/stdc++.h>
using namespace std;
template <class T>
void mxi(T& a, const T& b) {
  a = max(a, b);
}
template <class T>
void mni(T& a, const T& b) {
  a = min(a, b);
}
long double EPS = 1e-9;
long long dp[101][100100];
long long arr[101];
long long n, k;
long long cnt = 0;
long long go(long long id, long long left) {
  if (id == n - 1) {
    if (left <= arr[id])
      return dp[id][left] = 1;
    else
      return dp[id][left] = 0;
  }
  if (dp[id][left] != -1) return dp[id][left];
  dp[id][left] = 0;
  for (long long i = 0; i <= min(left, arr[id]); i++) {
    if (dp[id + 1][left - i] == -1)
      dp[id][left] = (dp[id][left] + go(id + 1, left - i)) % 1000000007;
    else
      dp[id][left] = (dp[id][left] + dp[id + 1][left - i]) % 1000000007;
  }
  return dp[id][left] % 1000000007;
}
void solve() {
  memset(dp, -1, sizeof(dp));
  cin >> n >> k;
  for (long long i = 0; i < (n); i++) cin >> arr[i];
  cout << go(0, k) << '\n';
}
signed main() {
  long long t, tab;
  t = 1;
  tab = t;
  while (t--) {
    solve();
  }
}
