#include <bits/stdc++.h>
using namespace std;
int n, k;
vector<int> a;
int dp[101][100 * 1000 + 1];
const int M = pow(10, 9) + 7;
int main() {
  cin >> n >> k;
  a.resize(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i <= n; ++i) dp[i][0] = 1;
  for (int i = 1; i <= n; ++i) {
    int sum = 0;
    for (int j = 0; j <= k; ++j) {
      sum += dp[i - 1][j];
      sum %= M;
      if (j > a[i - 1]) sum -= (dp[i - 1][j - a[i - 1] - 1] + M) % M;
      sum %= M;
      dp[i][j] = sum;
    }
  }
  cout << dp[n][k] % M << endl;
  return 0;
}
