#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
const double pi = acos(-1);
const double eps = 1e-10;
int dx[] = {1, 0, -1, 0};
int dy[] = {0, -1, 0, 1};
long long dp[110][100010];
long long sum[110][100010];
int main() {
  int n, k;
  cin >> n >> k;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i <= a[0]; i++) {
    dp[1][i] = 1;
    sum[1][i + 1] = sum[1][i] + dp[1][i];
  }
  long long ub = a[0];
  for (int i = 1; i < n; i++) {
    for (long long j = 0; j <= 100000; j++) {
      dp[i + 1][j] += (sum[i][min(j + 1, ub + 1)] - sum[i][max(0LL, j - a[i])]);
      dp[i + 1][j] %= MOD;
      sum[i + 1][j + 1] = sum[i + 1][j] + dp[i + 1][j];
      sum[i + 1][j + 1] %= MOD;
    }
    ub += a[i];
  }
  cout << dp[n][k] << endl;
}
