#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int main() {
  int N, K;
  cin >> N >> K;
  int a[110];
  for (int i = 0; i < N; i++) cin >> a[i];
  long long dp[110][100010];
  long long sum[110][100010];
  dp[0][0] = 1;
  for (int i = 0; i <= N; i++) {
    dp[i][0] = 1;
    sum[i][0] = 1;
  }
  for (int i = 0; i <= K; i++) sum[0][i] = 1;
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= K; j++) {
      if (j <= a[i - 1])
        dp[i][j] = sum[i - 1][j];
      else
        dp[i][j] = sum[i - 1][j] - sum[i - 1][j - a[i - 1] - 1];
      if (dp[i][j] > mod) dp[i][j] %= mod;
      sum[i][j] = sum[i][j - 1] + dp[i][j];
      if (sum[i][j] > mod) sum[i][j] %= mod;
    }
  }
  cout << dp[N][K] << endl;
  return 0;
}
