#include <bits/stdc++.h>
using namespace std;
long long memo[110][100010];
long long sum[110][100010];
int v[110];
int n;
long long solve(int k) {
  for (int j = 0; j <= v[0]; j++) {
    memo[0][j] = 1LL;
    sum[0][j] = j + 1;
  }
  for (int j = v[0] + 1; j <= k; j++) {
    memo[0][j] = 0LL;
    sum[0][j] = sum[0][j - 1];
  }
  for (int i = 1; i < n; i++) {
    memo[i][0] = sum[i - 1][0];
    sum[i][0] = memo[i][0];
    for (int j = 1; j <= v[i]; j++) {
      memo[i][j] = sum[i - 1][j];
      sum[i][j] = (sum[i][j - 1] + memo[i][j]) % 1000000007LL;
    }
    for (int j = v[i] + 1; j <= k; j++) {
      memo[i][j] = sum[i - 1][j] - sum[i - 1][j - v[i] - 1];
      sum[i][j] = (sum[i][j - 1] + memo[i][j]) % 1000000007LL;
    }
  }
  return memo[n - 1][k];
}
int main() {
  memset(memo, -1, sizeof(memo));
  cin.sync_with_stdio(0);
  cin.tie(0);
  int k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  cout << solve(k) << '\n';
  return 0;
}
