#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll MOD = 1e9 + 7;
ll devc(ll x, ll y) { return 1 + (x - 1) / y; }
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}
long long COM(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(20);
  ll N, K;
  cin >> N >> K;
  vector<ll> coef(K + 10, 0);
  coef[0] = 1;
  for (ll i = 0; i < (N); ++i) {
    ll a;
    cin >> a;
    ++a;
    for (ll j = K; j >= 0; --j)
      if (j + a <= K) coef[j + a] -= coef[j], coef[j + a] %= MOD;
  }
  COMinit();
  ll ans = 0;
  for (ll i = 0; i < (K + 1); ++i)
    ans += COM(i + N - 1, i) * coef[K - i] % MOD, ans %= MOD;
  cout << (ans) << '\n';
  return 0;
}
