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