#include <bits/stdc++.h>
using namespace std;
int a[100];
long b[100][100001];
long c[100001];
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = (0); i <= (n - 1); i++) cin >> a[i];
  for (int i = (0); i <= (n - 1); i++)
    for (int j = (0); j <= (k); j++) b[i][j] = 0;
  for (int j = (0); j <= (a[0]); j++) b[0][j] = 1;
  for (int i = (1); i <= (n - 1); i++) {
    c[0] = b[i - 1][0];
    for (int j = (1); j <= (k); j++)
      c[j] = (c[j - 1] + b[i - 1][j]) % 1000000007;
    for (int j = (0); j <= (k); j++) {
      b[i][j] =
          (b[i][j] + c[j] - (j <= a[i] ? 0 : c[j - a[i] - 1])) % 1000000007;
    }
  }
  cout << b[n - 1][k];
}
