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