#include <bits/stdc++.h>
using namespace std;
long long dp[105][100005];
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  long long mod = 1e9 + 7;
  int n;
  cin >> n;
  int k;
  cin >> k;
  vector<long long> arr(n);
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  for (int i = 0; i <= k; i++) dp[0][i] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= arr[i]; j++) dp[i][j] = dp[i - 1][j];
    for (int j = arr[i] + 1; j <= k; j++) {
      dp[i][j] = dp[i - 1][j] - dp[i - 1][j - arr[i] - 1];
      dp[i][j] = (mod + dp[i][j]) % mod;
    }
    for (int j = 1; j <= k; j++) {
      dp[i][j] = (dp[i][j] + dp[i][j - 1]) % mod;
    }
  }
  cout << dp[n][k] << endl;
  return 0;
}
