#include <bits/stdc++.h>
using namespace std;
long long const MOD = 1e9 + 7;
int dp[101][100001];
int vec[101];
int solve(int k, int n) {
  if (k == 0) return 1;
  if (k < 0 || n < 0) return 0;
  if (dp[n][k] != -1) return dp[n][k];
  int ans = 0;
  for (int i = 0; i <= vec[n]; i++) {
    ans = (ans + solve(k - i, n - 1)) % MOD;
  }
  return dp[n][k] = ans;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> vec[i];
  memset(dp, -1, sizeof(dp));
  cout << solve(k, n - 1);
  return 0;
}
