#include <bits/stdc++.h>
using namespace std;
long long dp[101][100001] = {};
int a[101];
long long sum[100001];
int n, k;
long long rec(int idx, int left) {
  if (idx < 1 && left != 0) return 0;
  if (idx < 1 && left == 0) return 1;
  long long& ans = dp[idx][left];
  if (ans != -1) return ans % 1000000007;
  ans = 0;
  for (int i = 0; i <= a[idx]; ++i) {
    if (left - i >= 0) ans += rec(idx - 1, left - i);
    ans %= 1000000007;
  }
  return ans % 1000000007;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  for (int i = 0; i <= a[1]; ++i) {
    dp[1][i] = 1;
  }
  for (int i = 2; i <= n; ++i) {
    sum[0] = dp[i - 1][0];
    for (int c = 1; c <= k; ++c) {
      sum[c] = (sum[c - 1] + dp[i - 1][c]) % 1000000007;
    }
    for (int j = 0; j <= k; ++j) {
      dp[i][j] = sum[j] - sum[j - min(j, a[i]) - 1];
    }
  }
  cout << dp[n][k] % 1000000007 << endl;
}
