#include <bits/stdc++.h>
using namespace std;
long long int n, k, arr[101], dp[101][100005];
long long int go(long long int ind, long long int cand) {
  if (cand == 0 && ind < n) return 1;
  if (ind == n - 1 && (cand) <= arr[n - 1]) return 1;
  if (ind >= n - 1) return 0;
  if (dp[ind][cand] != -1) return dp[ind][cand];
  dp[ind][cand] = 0;
  for (int i = 0; i <= arr[ind]; i++) {
    if (i <= cand) {
      dp[ind][cand] += go(ind + 1, cand - i);
      if (dp[ind][cand] >= 1000000007) dp[ind][cand] -= 1000000007;
    } else
      break;
  }
  return dp[ind][cand];
}
void solve() {
  cin >> n >> k;
  for (long long int i = 0; i < n; i++) cin >> arr[i];
  cout << go(0, k) % 1000000007;
}
int32_t main() {
  memset(dp, -1, sizeof(dp));
  solve();
  return 0;
}
