#include <bits/stdc++.h>
using namespace std;
int dp[101][100001];
int mod = 1e9 + 7;
int dfs(vector<int>& a, int i, int rem) {
  int n = a.size();
  if (rem <= 0 && i != n - 1) return 0;
  if (i == (n - 1) && rem <= a[n - 1]) return 1;
  if (i == n - 1 && rem > a[n - 1]) return 0;
  if (dp[i][rem] != -1) return dp[i][rem];
  dp[i][rem] = 0;
  for (int j = 0; j <= a[i]; j++) {
    if (j <= rem) {
      dp[i][rem] += dfs(a, i + 1, rem - j);
      dp[i][rem] %= mod;
    }
  }
  return dp[i][rem] % mod;
}
int main() {
  long long n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (long long i = 0; i < n; i++) cin >> a[i];
  memset(dp, -1, sizeof dp);
  cout << dfs(a, 0, k) % mod << endl;
  return 0;
}
