#include <bits/stdc++.h>
using namespace std;
long long dp[105][100005], pre[105][100005];
int main() {
  long long n, k;
  cin >> n >> k;
  long long a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= k; j++) {
      if (i == 0) {
        if (j <= a[0])
          dp[0][j] = 1;
        else
          dp[0][j] = 0;
        pre[0][j] = (j ? pre[0][j - 1] : 0) + dp[0][j];
        continue;
      }
      int left = j - a[i] - 1, right = j;
      dp[i][j] =
          (pre[i - 1][right] - (left >= 0 ? pre[i - 1][left] : 0)) % 1000000007;
      pre[i][j] = ((j ? pre[i][j - 1] : 0) + dp[i][j]) % 1000000007;
    }
  }
  cout << dp[n - 1][k] << endl;
  return 0;
}
