#include <bits/stdc++.h>
using namespace std;
long long int dp[105][100005];
long long int pre[100005];
void solve() {
  long long int n, k;
  cin >> n >> k;
  vector<long long int> v(n);
  for (long long int i = 0; i < n; i++) cin >> v[i];
  for (long long int i = 0; i <= k; i++) {
    if (i <= v[0]) dp[0][i] = 1;
  }
  for (long long int i = 1; i < n; i++) {
    pre[0] = dp[i - 1][0];
    for (long long int l = 1; l <= 100000; l++) {
      pre[l] = pre[l - 1] + dp[i - 1][l];
      pre[l] %= 1000000007;
    }
    for (long long int j = 0; j <= k; j++) {
      long long int g = j - v[i];
      dp[i][j] = g > 0 ? pre[j] - pre[g - 1] : pre[j];
      dp[i][j] %= 1000000007;
    }
  }
  cout << dp[n - 1][k];
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int T;
  T = 1;
  while (T--) {
    solve();
  }
  return 0;
}
