#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long dp[110][100010];
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, k;
  cin >> n >> k;
  vector<long long> a(n);
  for (long long i = (0); i < (n); i++) cin >> a[i];
  dp[0][1] = 1;
  for (long long i = (0); i < (k + 1); i++) dp[0][i + 1] += dp[0][i];
  for (long long i = (0); i < (n); i++) {
    for (long long j = (0); j < (k + 1); j++) {
      long long tmp = max(0LL, j - a[i]);
      dp[i + 1][j + 1] = (dp[i][j + 1] - dp[i][tmp]) % mod;
    }
    for (long long j = (0); j < (k + 1); j++)
      (dp[i + 1][j + 1] += dp[i + 1][j]) %= mod;
  }
  cout << dp[n][k + 1] - dp[n][k] << endl;
}
