#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ll n, k;
  cin >> n >> k;
  vector<ll> dp(k + 1);
  dp[k] = 1;
  for (int i = 0; i < n; ++i) {
    ll a;
    cin >> a;
    vector<ll> new_dp(k + 1);
    ll pref = 0;
    for (int j = k; j >= 0; --j) {
      pref += dp[j];
      new_dp[j] = pref;
      if (j + a <= k) {
        pref -= dp[j + a];
      }
      pref = (pref + mod) % mod;
    }
    swap(dp, new_dp);
  }
  cout << dp[0] << '\n';
  return 0;
}
