#include <bits/stdc++.h>
using namespace std;
long long dp[105][100005] = {0};
long long p[105][100005] = {0};
int main() {
  long long n, k;
  cin >> n >> k;
  long long a[n + 1];
  for (long long i = 1; i <= n; i++) cin >> a[i];
  dp[1][0] = 1;
  p[1][0] = 1;
  for (long long i = 1; i <= a[1]; i++) {
    dp[1][i] = 1;
    p[1][i] = dp[1][i] + p[1][i - 1];
  }
  for (long long i = a[1] + 1; i <= k; i++) {
    p[1][i] = (p[1][i - 1] + dp[1][i]) % 1000000007;
  }
  for (long long i = 2; i <= n; i++) {
    for (long long j = 0; j <= k; j++) {
      if (j - a[i] - 1 >= 0)
        dp[i][j] = (p[i - 1][j] - p[i - 1][j - a[i] - 1]) % 1000000007;
      else
        dp[i][j] = p[i - 1][j] % 1000000007;
      p[i][j] = (dp[i][j] + p[i][j - 1]) % 1000000007;
    }
  }
  cout << dp[n][k] << '\n';
}
