#include <bits/stdc++.h>
using namespace std;
const long long int INF = (long long int)1e18;
int N, K;
int dp[101][100001];
int csum[100001];
int a[101];
int main() {
  cin >> N >> K;
  for (int i = (0); i < (N); ++i) cin >> a[i];
  for (int i = (0); i < (N + 1); ++i)
    for (int j = (0); j < (K + 1); ++j) dp[i][j] = 0;
  dp[0][0] = 1;
  for (int i = (1); i < (N + 1); ++i) {
    csum[0] = dp[i - 1][0];
    for (int j = (1); j < (K + 1); ++j)
      csum[j] = (csum[j - 1] + dp[i - 1][j]) % 1000000007;
    for (int j = (0); j < (K + 1); ++j) {
      if (j - a[i - 1] - 1 >= 0) {
        dp[i][j] = csum[j] - csum[j - a[i - 1] - 1];
      } else {
        dp[i][j] = csum[j];
      }
      dp[i][j] %= 1000000007;
    }
  }
  cout << dp[N][K] << endl;
}
