#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
long long dp[110][MAXN];
const long long mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  vector<int> c(n);
  for (long long i = 0; i < n; i++) cin >> c[i];
  memset(dp, 0, sizeof(dp));
  for (long long i = 0; i < n + 1; i++) dp[i][0] = 1;
  for (long long i = 0; i < k + 1; i++) dp[0][i] = 1;
  for (long long i = 1; i < n + 1; i++) {
    for (long long j = 1; j < k + 1; j++) {
      long long a = (j - c[i - 1] - 1 >= 0) ? dp[i - 1][j - c[i - 1] - 1] : 0;
      long long b = dp[i - 1][j];
      dp[i][j] = ((b - a + mod) % mod + (i == n ? 0 : dp[i][j - 1])) % mod;
    }
  }
  cout << dp[n][k] << "\n";
  return 0;
}
