#include <bits/stdc++.h>
using namespace std;
long long n, k;
const long long mod = (long long)(1e9 + 7);
vector<long long> a;
long long dp[110][100010];
long long recurse(long long idx, long long le) {
  if (le < 0 or idx < 0) return 0;
  if (idx == n - 1) {
    if (le <= a[idx]) return 1;
    return 0;
  }
  if (dp[le][idx] != -1) return dp[le][idx];
  long long ans = 0;
  for (long long i = 0; i <= a[idx]; i++) {
    if (le - i >= 0) {
      ans = (ans % mod + recurse(idx + 1, le - i) % mod) % mod;
    } else {
      break;
    }
  }
  return dp[le][idx] = ans % mod;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> k;
  a.resize(n);
  memset(dp, -1, sizeof(dp));
  for (long long i = 0; i < n; i++) cin >> a[i];
  cout << recurse(0, k) % mod;
  return 0;
}
