#include <bits/stdc++.h>
using namespace std;
char _;
const long long MOD = 1000000007;
inline double degcos(double ang) { return cos(ang * 3.141592653589793 / 180); }
inline double degsin(double ang) { return sin(ang * 3.141592653589793 / 180); }
const int MAXN = 105, MAXK = 100005;
long long dp[MAXN][MAXK];
long long A[MAXN] = {}, P[MAXN] = {};
int N, K;
long long calc(int child, int rem) {
  if (rem < 0) return (long long)0;
  if (dp[child][rem]) return dp[child][rem];
  if (child == N + 1) {
    return rem == 0 ? 1 : 0;
  }
  if (rem > P[N] - P[child - 1]) {
    return dp[child][rem] = 0;
  }
  dp[child][rem] = 0;
  for (int i = 0; i < A[child] + 1; i += 1) {
    dp[child][rem] += calc(child + 1, rem - i);
    dp[child][rem] = dp[child][rem] % MOD;
  }
  return dp[child][rem];
}
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cin >> N >> K;
  for (int i = 1; i < N + 1; i += 1) {
    cin >> A[i];
    P[i] = A[i] + P[i - 1];
    dp[i][0] = (long long)1;
  }
  dp[N + 1][0] = (long long)1;
  calc(1, K);
  cout << dp[1][K];
}
