#include <bits/stdc++.h>
using namespace std;
long long n;
long long dp[101][100001], pre[101][100001];
vector<long long> v;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  long long k;
  cin >> n >> k;
  v.resize(n);
  for (auto &i : v) {
    cin >> i;
  }
  for (long long j = 0; j <= k; j++) {
    dp[0][j] = (v[0] >= j) ? 1 : 0;
    pre[0][j] = dp[0][j] + (j ? pre[0][j - 1] : 0);
    pre[0][j] %= 1000000007;
  }
  for (long long i = 1; i < n; i++) {
    for (long long j = 0; j <= k; j++) {
      dp[i][j] = pre[i - 1][j] - ((j - v[i]) ? pre[i - 1][j - v[i] - 1] : 0);
      if (dp[i][j] < 0) {
        dp[i][j] += 1000000007;
      }
    }
  }
  cout << dp[n - 1][k];
}
