#include <bits/stdc++.h>
using namespace std;
const long long int N = 2e5 + 1000, md = 1e9 + 7;
long long int n, k, a[N], dp[150][N], ps[150][N];
int32_t main() {
  cin >> n >> k;
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (long long int i = 0; i <= a[0]; i++) dp[0][i] = 1, ps[0][i] = i + 1;
  for (long long int i = a[0] + 1; i <= k; i++) ps[0][i] = ps[0][i - 1];
  for (long long int i = 0; i < n; i++) dp[i][0] = 1, ps[i][0] = 1;
  for (long long int i = 1; i < n; i++) {
    for (long long int j = 1; j <= k; j++) {
      if (min(a[i], j) != j)
        dp[i][j] = ps[i - 1][j] - ps[i - 1][j - min(a[i], j) - 1];
      else
        dp[i][j] = ps[i - 1][j];
      ps[i][j] = ps[i][j - 1] + dp[i][j];
      ps[i][j] %= md;
      dp[i][j] %= md;
    }
  }
  cout << dp[n - 1][k];
  return 0;
}
