#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const long long INF = 1LL << 60;
const long long MOD = 1000000007;
int N, K;
int a[100100];
long long dp[110][100100];
long long sum[110][100100];
int main() {
  cin >> N >> K;
  a[0] = 0;
  for (int i = (int)(1); i <= (int)(N); i++) cin >> a[i];
  for (int i = (int)(0); i <= (int)(N); i++) {
    dp[i][0] = 1;
    sum[i][0] = 1;
  }
  for (int j = (int)(0); j <= (int)(K); j++) {
    sum[0][j] = 1;
  }
  for (int i = (int)(1); i <= (int)(N); i++) {
    for (int j = (int)(1); j <= (int)(K); j++) {
      if (j <= a[i])
        dp[i][j] = sum[i - 1][j];
      else
        dp[i][j] = sum[i - 1][j] - sum[i - 1][j - a[i] - 1];
      dp[i][j] %= MOD;
      sum[i][j] = sum[i][j - 1] + dp[i][j];
      sum[i][j] %= MOD;
    }
  }
  cout << dp[N][K] << endl;
  return 0;
}
