#include <bits/stdc++.h>
using namespace std;
int n, k;
int a[105000];
int ans[150][105000];
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i <= a[0]; i++) {
    ans[0][i] = 1;
  }
  for (int i = 1; i < n; i++) {
    ans[i][0] = ans[i - 1][0];
    for (int j = 1; j <= a[i]; j++) {
      ans[i][j] = (ans[i - 1][j] + ans[i][j - 1]) % 1000000007;
    }
    for (int j = a[i] + 1; j <= k; j++) {
      ans[i][j] = (ans[i][j - 1] + ans[i - 1][j] - ans[i - 1][j - a[i] - 1]) %
                  1000000007;
    }
  }
  cout << ans[n - 1][k] % 1000000007 << endl;
}
