#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
long long d[105][100005], sum[105][100005];
int n, k, a[105];
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 0; i <= min(a[1], k); i++) d[1][i] = 1;
  for (int i = 1; i <= n; i++) d[i][0] = 1;
  sum[1][0] = 1;
  for (int i = 1; i <= k; i++) sum[1][i] = sum[1][i - 1] + d[1][i];
  for (int i = 2; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      int st = max(0, j - a[i]);
      int dr = j;
      if (st == 0)
        d[i][j] = sum[i - 1][dr] % MOD;
      else
        d[i][j] = (sum[i - 1][dr] + MOD - sum[i - 1][st - 1]) % MOD;
      sum[i][j] = (sum[i][j - 1] + d[i][j]) % MOD;
    }
  }
  cout << d[n][k];
  return 0;
}
