#include <bits/stdc++.h>
using namespace std;
int N, K;
vector<int> A(100);
long long mod = 1e9 + 7;
vector<vector<long long> > dp(100, vector<long long>(100100, -1));
long long solve(int _N, int _K) {
  if (dp[_N][_K] != -1) return dp[_N][_K];
  if (_N == N - 1) {
    if (_K <= A[_N]) return dp[_N][_K] = 1;
    return dp[_N][_K] = 0;
  }
  long long sum = 0;
  for (int i = 0; i < (A[_N] + 1); i++) {
    (sum += solve(_N + 1, _K - i)) %= mod;
  }
  return dp[_N][_K] = sum;
}
int main() {
  cin >> N >> K;
  for (int i = 0; i < (N); i++) cin >> A[i];
  long long sum = 0;
  cout << solve(0, K) << endl;
}
