#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 100 + 5;
const int K = 1e5 + 5;
const int MOD = 1e9 + 7;
ll dp[N][K];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  vector<int> a(n + 1);
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    vector<int> sum(k + 1);
    sum[0] = dp[i - 1][0];
    for (int j = 1; j <= k; j++) {
      sum[j] = (sum[j - 1] + dp[i - 1][j]) % MOD;
    }
    for (int j = 0; j <= k; j++) {
      if (j <= a[i]) {
        dp[i][j] = sum[j];
      } else {
        dp[i][j] = max(0, sum[j] - sum[j - a[i] - 1]);
      }
    }
  }
  cout << dp[n][k] << '\n';
}
