#include <bits/stdc++.h>
using namespace std;
const int MD = 1e9 + 7;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n, 0);
  for (int i = 0; i < n; i++) cin >> a[i];
  vector<vector<long long>> dp(n + 1, vector<long long>(k + 1, -1));
  function<long long(int, int)> solve = [&](int i, int k) -> long long {
    if (i == n && k == 0) {
      return 1;
    } else if (i == n && k) {
      return 0;
    }
    if (dp[i][k] != -1) {
      return dp[i][k];
    }
    long long nways = 0;
    for (int bal = 0; bal <= a[i]; bal++) {
      if (k - bal < 0) {
        break;
      }
      nways = (nways + solve(i + 1, k - bal)) % MD;
    }
    return dp[i][k] = nways;
  };
  long long ans = solve(0, k);
  cout << ans << endl;
  return 0;
}
