#include <bits/stdc++.h>
using namespace std;
long long dp[110][1000010], sdp[1000010], a[1100], sa[1100], n, m;
int main() {
  sa[0] = 0;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i], sa[i] = max(sa[i - 1] + a[i], m);
  memset(dp, 0, sizeof dp);
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    sdp[0] = 1;
    for (long long k = 1; k <= (sa[i] + 100); k++)
      sdp[k] = sdp[k - 1] + dp[i - 1][k];
    for (long long j = 0; j <= sa[i]; j++) {
      if (j <= sa[i])
        dp[i][j] = sdp[j] - ((j - a[i] - 1) >= 0 ? sdp[j - a[i] - 1] : 0);
      dp[i][j] %= 1000000007;
    }
  }
  cout << dp[n][m];
}
