#include <bits/stdc++.h>
using namespace std;
const long long mdl = 1e9 + 7;
int main() {
  long long n, k;
  cin >> n >> k;
  long long ans[n + 1][k + 1];
  memset(ans, 0, sizeof ans);
  long long a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i <= n; i++) ans[i][0] = 1;
  for (int i = 1; i <= k; i++) {
    ans[1][i] = (i <= a[0]) ? 1 : 0;
  }
  for (int i = 2; i <= n; i++) {
    long long sum = 0;
    for (int j = 0; j <= k; j++) {
      if (j == 0)
        ans[i][j] = ans[i - 1][j];
      else {
        ans[i][j] = ans[i][j - 1] + ans[i - 1][j];
        if (j - 1 - a[i - 1] >= 0) ans[i][j] -= ans[i - 1][j - 1 - a[i - 1]];
      }
    }
  }
  cout << (ans[n][k] % mdl) << endl;
  return 0;
}
