#include <bits/stdc++.h>
using namespace std;
long long m = 1000000007;
vector<vector<long long>> dp(101, vector<long long>(100002));
int main() {
  {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
  };
  long long n, k;
  cin >> n >> k;
  vector<long long> arr(n);
  for (int i = 0; i < n; i++) cin >> arr[i];
  for (int i = 0; i <= n; i++) dp[i][0] = 1;
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    long long temp = 1;
    int j;
    for (j = 1; j <= arr[i - 1]; j++) {
      temp += dp[i - 1][j];
      temp %= m;
      dp[i][j] = temp;
    }
    for (j; j <= k; j++) {
      dp[i][j] = dp[i][arr[i - 1]] - dp[i][j - arr[i - 1] - 1];
      if (dp[i][j] == 0) break;
    }
  }
  cout << dp[n][k] << "\n";
  return 0;
}
