#include <bits/stdc++.h>
using namespace std;
long long dp[101][100005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  int n, mod = 1000000007, i, j, k;
  cin >> n >> k;
  int a[n + 1];
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    dp[i][0] = 1;
  }
  for (i = 1; i < 100005; i++) {
    if (i <= a[1])
      dp[1][i] = dp[1][i - 1] + 1;
    else
      dp[1][i] = dp[1][i - 1];
  }
  for (i = 2; i <= n; i++) {
    for (j = 1; j < 100005; j++) {
      if (j <= a[i]) {
        dp[i][j] = dp[i][j - 1] + dp[i - 1][j];
        dp[i][j] %= mod;
      } else {
        dp[i][j] = dp[i][j - 1] + dp[i - 1][j];
        dp[i][j] %= mod;
        dp[i][j] -= dp[i - 1][j - a[i] - 1];
        dp[i][j] %= mod;
      }
    }
  }
  if (k == 0)
    cout << 1;
  else
    cout << dp[n][k] - dp[n][k - 1];
}
