#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
const int SIZE = 2 * 1e5;
ll powm(ll x, ll k) {
  ll res = 1;
  while (k) {
    if (k & 1) res = res * x % MOD;
    k >>= 1;
    x = x * x % MOD;
  }
  return res;
}
ll inv(ll x) { return powm(x, MOD - 2); }
struct Comb {
  ll fact[SIZE];
  ll invFact[SIZE];
  Comb() {
    fact[0] = 1;
    for (int i = 1; i < SIZE; i++) fact[i] = fact[i - 1] * i % MOD;
    invFact[SIZE - 1] = inv(fact[SIZE - 1]);
    for (int i = SIZE - 2; i >= 0; i--)
      invFact[i] = invFact[i + 1] * (i + 1) % MOD;
  }
  ll operator()(int n, int k) {
    return fact[n] * invFact[k] % MOD * invFact[n - k] % MOD;
  }
} comb;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  vector<vector<ll>> dp(n + 1, vector<ll>(k + 1));
  dp[0][0] = 1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= k; j++) {
      int to = j + a[i] + 1;
      if (to <= k) (dp[i + 1][to] -= dp[i][j]) %= MOD;
      (dp[i + 1][j] += dp[i][j]) %= MOD;
    }
  }
  vector<ll> A = dp[n];
  vector<ll> B(k + 1);
  for (int i = 0; i <= k; i++) {
    B[i] = comb(i + n - 1, n - 1);
  }
  ll res = 0;
  for (int i = 0; i <= k; i++) {
    res += A[i] * B[k - i] % MOD;
    res %= MOD;
  }
  cout << res << endl;
  return 0;
}
