#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int M = 100111;
const int mod = 1000000007;
int main() {
  int n, k, a[M];
  ll dp[101][M] = {}, sum[M] = {};
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  dp[0][0] = 1;
  for (int i = 1; i < n + 1; i++) {
    for (int j = 1; j < k + 1; j++)
      sum[j] = (sum[j - 1] + dp[i - 1][j - 1]) % mod;
    for (int j = 0; j < k + 1; j++) {
      dp[i][j] = (sum[j] - sum[max(0, j - a[i - 1])] + dp[i - 1][j]) % mod;
    }
  }
  cout << dp[n][k] << endl;
}
