#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
long long dp[101][100005];
int main() {
  long long n;
  cin >> n;
  long long k;
  cin >> k;
  long long candy[n];
  for (long long j = 1; j <= n; j++) cin >> candy[j];
  for (long long i = 1; i <= k; i++) {
    dp[0][i] = 0;
  }
  dp[0][0] = 1;
  for (long long i = 1; i <= n; i++) {
    long long sum[k + 1];
    sum[0] = dp[i - 1][0];
    for (long long j = 1; j <= k; j++) {
      sum[j] = ((dp[i - 1][j]) % mod + sum[j - 1] % mod) % mod;
    }
    for (long long j = 0; j <= k; j++) {
      long long ans = sum[j];
      long long x = j - candy[i];
      if (x >= 1) {
        ans = (ans % mod) - (sum[x - 1] % mod) % mod;
      }
      dp[i][j] = ans % mod;
    }
  }
  cout << dp[n][k];
  return 0;
}
