#include <bits/stdc++.h>
using namespace std;
int mod = 1e9 + 7;
long long dp[110][100010];
int main() {
  int n, k;
  cin >> n >> k;
  int a[n + 1];
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  for (int j = 0; j <= k; ++j) {
    dp[1][j] = (j > a[1]) ? 0 : 1;
  }
  for (int i = 2; i <= n; ++i) {
    for (int j = 0; j <= k; ++j) {
      if (j == 0)
        dp[i][j] = dp[i - 1][j];
      else
        dp[i][j] = (mod + dp[i][j - 1] + dp[i - 1][j] -
                    ((j - a[i] - 1 >= 0) ? dp[i - 1][j - a[i] - 1] : 0)) %
                   mod;
    }
  }
  cout << dp[n][k];
}
