#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
struct edge {
  long long to, cost, val;
};
template <class T, class U>
bool chmin(T& a, const U& b) {
  if (a <= b) return false;
  a = b;
  return true;
}
template <class T, class U>
bool chmax(T& a, const U& b) {
  if (a >= b) return false;
  a = b;
  return true;
}
long long dp[110][110000], sum[110][110000];
int a[110000];
signed main() {
  int N, K;
  cin >> N >> K;
  for (int i = 1; i <= N; i++) cin >> a[i];
  for (int i = 0; i < 110; i++) {
    dp[i][0] = 1;
    sum[i][0] = 1;
  }
  for (int i = 0; i < 110000; i++) sum[0][i] = 1;
  for (int i = 1; i <= N; i++) {
    int x = a[i];
    for (int j = 1; j <= K; j++) {
      if (j - x - 1 < 0)
        dp[i][j] = sum[i - 1][j];
      else
        dp[i][j] = sum[i - 1][j] - sum[i - 1][j - x - 1];
      dp[i][j] %= 1000000007;
      sum[i][j] = sum[i][j - 1] + dp[i][j];
      sum[i][j] %= 1000000007;
    }
  }
  cout << dp[N][K] << endl;
}
