#include <bits/stdc++.h>
using ll = long long;
using namespace std;
const ll mod = 1e9 + 7;
ll n, k, a[104];
ll dp[104][100005];
ll sum[104][100005];
ll get(ll x, ll L, ll R) {
  if (L <= 0) {
    return sum[x][R] % mod;
  }
  return max(((sum[x][R] + mod) - (sum[x][L - 1] + mod)) % mod, 0LL);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (ll i = 1; i <= n; i++) {
    cin >> a[i];
  }
  fill(sum[0], sum[0] + k + 2, 1);
  for (ll i = 1; i <= n; ++i) {
    for (ll j = 0; j <= k; ++j) {
      dp[i][j] = get(i - 1, j - a[i], j) % mod;
      if (j == 0) {
        sum[i][j] = dp[i][j] % mod;
      } else {
        sum[i][j] = (sum[i][j] + sum[i][j - 1] + dp[i][j]) % mod;
      }
    }
  }
  cout << dp[n][k] % mod;
  return 0;
}
