#include <bits/stdc++.h>
using ll = long long;
const int mod = 1000000007;
const ll infll = (1ll << 60);
using namespace std;
ll dp[110][100010];
ll sum[100010];
int main() {
  int n, k;
  cin >> n >> k;
  vector<ll> a(n);
  for (auto &k : a) cin >> k;
  dp[0][0] = 1;
  for (int i = 0; i <= k; ++i) {
    sum[i + 1] = (sum[i] + dp[0][i]) % mod;
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j <= k; ++j) {
      dp[i + 1][j] = (sum[j + 1] - sum[j - a[i]] + mod) % mod;
    }
    for (int j = 0; j <= k; ++j) {
      sum[j + 1] = (sum[j] + dp[i + 1][j]) % mod;
    }
  }
  cout << dp[n][k] << endl;
}
