#include <bits/stdc++.h>
using namespace std;
long long n, k;
vector<long long> a;
long long mod = 1e9 + 7;
long long dp[105][100005];
long long solve(long long child, long long candiesLeft) {
  if (child == n) {
    if (candiesLeft == 0) return 1;
    return 0;
  }
  if (dp[child][candiesLeft] != -1) {
    return dp[child][candiesLeft];
  }
  if (candiesLeft == 0) return 1;
  if (candiesLeft < 0) return 0;
  long long ans = 0;
  for (long long i = 0; i <= min(candiesLeft, a[child]); i++) {
    ans = (ans + solve(child + 1, candiesLeft - i)) % mod;
  }
  return dp[child][candiesLeft] = ans;
}
signed main() {
  cin >> n >> k;
  a.resize(n);
  memset(dp, -1, sizeof(dp));
  for (long long i = 0; i < n; ++i) {
    cin >> a[i];
  }
  cout << solve(0, k) << endl;
}
