#include <bits/stdc++.h>
using namespace std;
const int N = 1e2 + 5;
const int INF = 1e9;
const int MOD = 1e9 + 7;
long long n, k;
long long a[N];
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
  }
  long long f[N][k + 5];
  for (long long j = 0; j <= a[1]; j++) {
    f[1][j] = 1;
  }
  for (long long j = 1; j <= k; j++) {
    (f[1][j] += f[1][j - 1]) %= MOD;
  }
  for (long long i = 2; i <= n; i++) {
    for (long long j = 0; j <= k; j++) {
      long long left = (j - a[i] - 1 < 0) ? 0 : f[i - 1][j - a[i] - 1];
      f[i][j] = (f[i - 1][j] - left + MOD) % MOD;
      (f[i][j] += f[i][j - 1]) %= MOD;
    }
  }
  long long ans = (f[n][k] - f[n][k - 1] + MOD) % MOD;
  cout << ans << endl;
  return 0;
}
