#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
int main() {
  ll N, K;
  cin >> N >> K;
  function<void(ll&, ll)> add_self = [&](ll& lhs, ll rhs) {
    lhs += rhs;
    if (lhs >= mod) {
      lhs -= mod;
    }
  };
  vector<ll> dp(K + 1);
  dp[0] = 1;
  for (int i = 0; i < N; ++i) {
    ll x;
    cin >> x;
    for (int used = K; used >= 0; --used) {
      for (int avail = 1; avail <= min(x, K - used); ++avail) {
        add_self(dp[used + avail], dp[used]);
      }
    }
  }
  cout << dp[K] << endl;
  return 0;
}
