#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10, K = 110;
long long int dp[K][N], pr[N], mod = 1e9 + 7;
long long int ok(long long int &x) {
  x %= mod;
  x += mod;
  x %= mod;
}
int main() {
  long long int n, k;
  cin >> n >> k;
  dp[0][0] = 1;
  fill(pr, pr + N - 5, 1);
  pr[0] = 0;
  for (int i = 0; i < n; i++) {
    long long int x;
    cin >> x;
    for (int j = k; j >= 0; j--) {
      dp[i + 1][j] = pr[j + 1] - pr[max(j - x, 0ll)];
      ok(dp[i + 1][j]);
    }
    for (int j = 0; j <= k + 1; j++) {
      pr[j] = (pr[j] == 0) ? 0 : pr[j - 1] + dp[i + 1][j - 1];
      ok(pr[j]);
    }
  }
  cout << dp[n][k] << '\n';
}
