#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long INF = 1e+14;
const long double eps = 1e-8;
const long double pi = acos(-1.0);
void Yes() {
  cout << "Yes" << endl;
  exit(0);
}
void No() {
  cout << "No" << endl;
  exit(0);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, K;
  cin >> N >> K;
  int a[110];
  for (int i = 0; i < N; i++) cin >> a[i];
  long long dp[110][100100], sum[110][100100];
  for (int j = 0; j < K + 1; j++) {
    if (j <= a[0])
      dp[0][j] = 1LL;
    else
      dp[0][j] = 0;
    sum[0][j + 1] = sum[0][j] + dp[0][j];
  }
  for (int i = 1; i <= N - 1; i++) {
    for (int j = 0; j < K + 1; j++) {
      dp[i][j] = sum[i - 1][j + 1] - sum[i - 1][j - a[i]];
      dp[i][j] %= mod;
      sum[i][j + 1] = sum[i][j] + dp[i][j];
      sum[i][j + 1] %= mod;
    }
  }
  cout << dp[N - 1][K] << endl;
  return 0;
}
