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