#include <bits/stdc++.h>
double pi = 3.141592653589793;
using namespace std;
long long n, k, a[111];
long long dp[111][111111];
signed main() {
  cin >> n >> k;
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 0; i < n + 1; i++)
    for (long long j = 0; j < k + 1; j++) dp[i][j] = 0;
  dp[0][0] = 1;
  for (long long i = 1; i < k + 1; i++) dp[0][i] += dp[0][i - 1];
  for (long long i = 1; i < n + 1; i++) {
    for (long long j = 0; j < k + 1; j++) {
      if (j > 0)
        dp[i][j] = (dp[i][j - 1] + dp[i - 1][j] -
                    (j > a[i - 1] ? dp[i - 1][j - a[i - 1] - 1] : 0)) %
                   1000000007;
      else
        dp[i][j] = 1;
    }
  }
  cout << (dp[n][k] - dp[n][k - 1]) % 1000000007 << endl;
  return 0;
}
