#include <bits/stdc++.h>
using namespace std;
vector<vector<long long>> dp(100 + 1, vector<long long>(100000 + 1, 0));
int main(void) {
  long long n, k;
  cin >> n >> k;
  vector<long long> a(n + 1), sum_a(n + 1);
  for (int i = 1; i <= n; i++) cin >> a[i];
  sum_a[1] = a[1];
  for (int i = 2; i <= n; i++) sum_a[i] = sum_a[i - 1] + a[i];
  for (int i = 0; i <= a[1]; i++) dp[1][i] = 1;
  for (int i = 1; i <= n; i++) dp[i][0] = 1;
  for (int i = 2; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      if (0 <= j - a[i] - 1)
        dp[i][j] = (dp[i][j - 1] + dp[i - 1][j] - dp[i - 1][j - a[i] - 1]) %
                   1000000007;
      else
        dp[i][j] = (dp[i][j - 1] + dp[i - 1][j]) % 1000000007;
    }
  }
  cout << dp[n][k] << endl;
  return 0;
}
