#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7, arr[105], pre[105], sum[105], dp[105][100005];
long long solve(long long n, long long k) {
  dp[0][0] = 1;
  for (int i = 1; i <= k; ++i) dp[0][i] = 0;
  for (int i = 1; i <= n; ++i) {
    sum[0] = dp[i - 1][0];
    for (int j = 1; j <= k; ++j) sum[j] = (sum[j - 1] + dp[i - 1][j]) % mod;
    long long bound = min(k, pre[i]);
    for (int j = 0; j <= bound; ++j) {
      dp[i][j] = sum[j];
      if (j > arr[i]) dp[i][j] = (dp[i][j] - sum[j - arr[i] - 1] + mod) % mod;
    }
  }
  return dp[n][k];
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) {
    cin >> arr[i];
    pre[i] = pre[i - 1] + arr[i];
  }
  cout << solve(n, k) << '\n';
  return 0;
}
