#include <bits/stdc++.h>
using namespace std;
template <typename T>
void swap(T& a, T& b) {
  T temp = a;
  a = b;
  b = temp;
}
const long long int N = 100005;
long long int dp[101][N];
vector<long long int> a;
vector<long long int> ca;
long long int n;
long long int rec(long long int v, long long int k) {
  if (k == 0) return 1;
  if (k < 0) return 0;
  if (v == n) return 0;
  if (dp[v][k] != -1) return dp[v][k];
  if (k > ca[v]) return dp[v][k] = 0;
  if (k == ca[v]) return dp[v][k] = 1;
  long long int ans = 0;
  for (long long int i = 0; i <= a[v] && k - i >= 0; i++) {
    ans = (ans + rec(v + 1, k - i)) % 1000000007;
  }
  return dp[v][k] = ans;
}
void solve() {
  long long int k;
  cin >> n >> k;
  a.assign(n, 0);
  ca.assign(n, 0);
  for (long long int i = 0; i <= n - 1; i++) cin >> a[i];
  ca[n - 1] = a[n - 1];
  for (long long int i = n - 2; i >= 0; i--) ca[i] = a[i] + ca[i + 1];
  memset(dp, -1, sizeof(dp));
  cout << rec(0, k) << endl;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  { solve(); }
  return 0;
}
