#include <bits/stdc++.h>
using namespace std;
vector<long long> v(101);
vector<vector<long long>> dp(101, vector<long long>(100005, 0));
inline long long add(long long x, long long y) {
  x += y;
  if (x >= 1000000007) x -= 1000000007;
  return x;
}
inline long long sub(long long x, long long y) {
  x -= y;
  if (x < 0) x += 1000000007;
  return x;
}
int main() {
  long long n = 0, k = 0;
  cin >> n >> k;
  for (long long i = 0; i < n; i++) cin >> v[i];
  for (long long i = 1; i <= n; i++) dp[i][0] = 1;
  for (long long j = 0; j <= k; j++) {
    if (j <= v[0])
      dp[1][j] = 1;
    else
      dp[1][j] = 0;
  }
  if (n > 1)
    for (long long j = 1; j <= k; j++) dp[1][j] = add(dp[1][j], dp[1][j - 1]);
  for (long long i = 2; i <= n; i++) {
    for (long long j = 1; j <= k; j++) {
      long long mx = j, mn = j - v[i - 1] - 1;
      if (mn < 0)
        dp[i][j] = dp[i - 1][mx] - 0;
      else
        dp[i][j] = (dp[i - 1][mx] - dp[i - 1][mn]);
    }
    if (i < n)
      for (long long j = 1; j <= k; j++) dp[i][j] = add(dp[i][j], dp[i][j - 1]);
  }
  cout << dp[n][k] % 1000000007;
  return 0;
}
