#include <bits/stdc++.h>
using namespace std;
long long int pd[110][100100];
long long int sum[110][100100];
long long int a[110];
long long int n;
long long int k;
long long int solve() {
  int i, j;
  pd[0][0] = 1;
  sum[0][0] = 1;
  for (i = 1; i <= n; i++) {
    pd[i][0] = 1;
    sum[i][0] = 1;
  }
  for (j = 1; j <= k; j++) {
    sum[0][j] = (sum[0][j - 1] + pd[0][j]) % 1000000007;
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= k; j++) {
      long long int c = max((long long int)-1, j - a[i] - 1);
      if (c != -1)
        pd[i][j] = (sum[i - 1][j] % 1000000007 - sum[i - 1][c] % 1000000007) %
                   1000000007;
      else
        pd[i][j] = (sum[i - 1][j]) % 1000000007;
    }
    for (j = 1; j <= k; j++) {
      sum[i][j] =
          (sum[i][j - 1] % 1000000007 + pd[i][j] % 1000000007) % 1000000007;
    }
  }
  return pd[n][k] % 1000000007;
}
int main() {
  int i;
  cin >> n >> k;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
  }
  cout << solve() << endl;
}
