#include <bits/stdc++.h>
using namespace std;
typedef priority_queue<long long> pq;
long long dp[101][100001];
int main() {
  long long n, k;
  cin >> n >> k;
  long long a[n + 1];
  for (long long i = 1; i < n + 1; i++) cin >> a[i];
  for (long long i = 1; i < n + 1; i++) dp[i][0] = 1;
  for (long long i = 1; i < k + 1; i++) {
    if (i <= a[1]) dp[1][i] = 1;
    dp[1][i] += dp[1][i - 1];
  }
  for (long long i = 2; i < n + 1; i++)
    for (long long j = 1; j < k + 1; j++) {
      long long x = 0;
      if (j > a[i]) x = dp[i - 1][j - a[i] - 1];
      dp[i][j] = dp[i - 1][j] - x;
      if (i != n)
        dp[i][j] =
            (dp[i][j - 1] % 1000000007 + dp[i][j] % 1000000007) % 1000000007;
    }
  if (n == 1)
    cout << dp[n][k] - dp[n][a[1]];
  else
    cout << dp[n][k];
}
