#include <bits/stdc++.h>
using namespace std;
struct pair_hash {
  template <class T1, class T2>
  std::size_t operator()(const std::pair<T1, T2> &p) const {
    auto h1 = std::hash<T1>{}(p.first);
    auto h2 = std::hash<T2>{}(p.second);
    return h1 ^ h2;
  }
};
int n, k;
int arr[123];
long long int dp[123][100005];
long long int solve(int index, int left) {
  if (left < 0) return -1;
  if (index == 0) {
    if (arr[index] >= left)
      return dp[index][left] = 1;
    else
      return dp[index][left] = 0;
  }
  if (left == 0) return 1;
  if (dp[index][left] >= 0) return dp[index][left];
  long long int ans = 0;
  for (int i = 0; i <= arr[index]; i++) {
    if (i <= left) {
      ans += solve(index - 1, left - i);
      ans = ans % (long long int)(1e9 + 7);
    } else
      break;
  }
  return dp[index][left] = ans % (long long int)(1e9 + 7);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int i, j;
  cin >> n >> k;
  for (i = 0; i < 123; i++) {
    for (j = 0; j < 100005; j++) dp[i][j] = -1;
  }
  for (i = 0; i < n; i++) cin >> arr[i];
  cout << solve(n - 1, k);
  return 0;
}
