#include <bits/stdc++.h>
using namespace std;
long long dp[101][100002], k, n, a[101];
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int sum = 0; sum <= a[0]; ++sum) dp[0][sum] = 1;
  for (int pos = 1; pos < n; ++pos) {
    dp[pos][0] = dp[pos - 1][0];
    for (int sum = 1; sum <= a[pos]; ++sum)
      dp[pos][sum] = (dp[pos - 1][sum] + dp[pos][sum - 1]) % 1000000007;
    for (int sum = a[pos] + 1; sum <= k; ++sum) {
      dp[pos][sum] = (dp[pos - 1][sum] + dp[pos][sum - 1]) % 1000000007;
      dp[pos][sum] -= dp[pos - 1][sum - a[pos] - 1];
      dp[pos][sum] %= 1000000007;
      if (dp[pos][sum] < 1000000007) dp[pos][sum] += 1000000007;
    }
  }
  cout << dp[n - 1][k] << endl;
  return 0;
}
