#include <bits/stdc++.h>
using namespace std;
long long dp[110][101010];
int main() {
  int N, K;
  cin >> N >> K;
  vector<int> a(N);
  for (auto &i : a) cin >> i;
  dp[0][0] = 1;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j <= K; j++) {
      dp[i + 1][j] += dp[i][j];
      dp[i + 1][min(j + a[i], K) + 1] -= dp[i][j];
    }
    for (int j = 0; j < K; j++) {
      dp[i + 1][j + 1] += dp[i + 1][j];
      dp[i + 1][j + 1] %= 1000000007LL;
    }
  }
  cout << dp[N][K] << endl;
  return 0;
}
