#include <bits/stdc++.h>
using namespace std;
int a[101];
long long b[101][100005];
long long c[101][100005];
int main() {
  int mod = 1000000000 + 7;
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < k; i++)
    if (i <= a[0]) b[1][i] = 1;
  for (int i = 2; i <= n; i++) {
    c[i - 1][0] = 1;
    for (int j = 1; j <= k; j++) {
      c[i - 1][j] = c[i - 1][j - 1] + b[i - 1][j];
      c[i - 1][j] %= mod;
    }
    for (int j = 0; j <= k; j++) {
      b[i][j] = c[i - 1][j];
      if (j - a[i - 1] - 1 >= 0) {
        b[i][j] -= c[i - 1][j - a[i - 1] - 1];
        if (b[i][j] < 0) b[i][j] += mod;
      }
    }
  }
  cout << b[n][k];
  return 0;
}
