#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 10, MOD = 1e9 + 7;
long long int N, K, A[MAX], dp[105][MAX];
long long int solve(int idx, int rem) {
  if (idx == N && !rem) return 1;
  if (idx >= N || rem < 0) return 0;
  if (dp[idx][rem] != -1) return dp[idx][rem];
  int res = 0;
  for (int i = 0; i <= A[idx]; i++) {
    res += solve(idx + 1, rem - i) % MOD;
  }
  return dp[idx][rem] = res % MOD;
}
int main() {
  memset(dp, -1, sizeof dp);
  cin >> N >> K;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  cout << solve(0, K) << endl;
  return 0;
}
