#include <bits/stdc++.h>
using namespace std;
const long long MAX = 1e5 + 100;
const long long mod = 1e9 + 7;
const long long INF = 1e18 + 12;
set<pair<long long, long long> > ss;
long long dp[100][MAX];
long long sum[MAX];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long tt = 1;
  while (tt--) {
    long long n, k;
    cin >> n >> k;
    long long a[n];
    for (long long i = 0; i < n; i++) {
      cin >> a[i];
    }
    dp[0][0] = 1;
    for (long long i = 1; i < k + 1; i++) dp[0][i] = 0;
    for (long long i = 1; i <= k + 2; i++) sum[i] = 1;
    sum[0] = 0;
    long long zero = 0;
    for (long long i = 1; i <= n; i++) {
      for (long long j = 0; j <= k + 1; j++) {
        dp[i][j] = sum[j + 1] - sum[max(j - a[i - 1], zero)];
      }
      long long ss = 0;
      for (long long j = 1; j <= k + 1; j++) {
        ss += (dp[i][j - 1]) % mod;
        sum[j] = ss % mod;
      }
    }
    cout << dp[n][k] << "\n";
  }
}
