#include <bits/stdc++.h>
using namespace std;
const int N = 100 + 5, K = 1e5 + 5, MOD = 1e9 + 7;
int nums[N];
int dp[N][K], pre[N][K];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < (int)n; i++) {
    cin >> nums[i];
  }
  dp[0][0] = 1;
  pre[0][0] = 1;
  for (int i = 1; i < (int)n; i++) {
    dp[i][0] = 1;
    pre[i][0] = dp[i][0];
  }
  for (int i = 1; i < (int)nums[0] + 1; i++) {
    dp[0][i] = 1;
    pre[0][i] = pre[0][i - 1] + dp[0][i];
  }
  for (int i = 1; i < (int)n; i++) {
    for (int j = 1; j < (int)k + 1; j++) {
      int lo = j - min(nums[i], j) - 1;
      dp[i][j] = pre[i - 1][j] - (lo >= 0 ? pre[i - 1][lo] : 0);
      pre[i][j] = (1ll * pre[i][j - 1] + 1ll * dp[i][j]) % MOD;
    }
  }
  cout << dp[n - 1][k] << endl;
}
