#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> dp;
vector<int> v;
void solve() {
  int n, k;
  cin >> n >> k;
  v.resize(n);
  dp.resize(n, vector<int>(k + 1, -1));
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  for (int i = 0; i <= k; i++) {
    dp[0][i] = i <= v[0] ? 1 : 0;
  }
  for (int i = 0; i < n; i++) {
    dp[i][0] = 1;
  }
  for (int i = 1; i < n; i++) {
    for (int j = 1; j <= k; j++) {
      dp[i][j] = (1000000007 + dp[i - 1][j] + dp[i][j - 1] -
                  ((j - v[i] - 1 >= 0) ? dp[i - 1][j - v[i] - 1] : 0)) %
                 1000000007;
    }
  }
  cout << dp[n - 1][k] << "\n";
}
int main() {
  cout.precision(10);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
