#include <bits/stdc++.h>
const long long MOD = 1e9 + 7;
const long long INF = 1LL << 60;
const double PI = 3.14159265358979323846;
const int NMAX = 100005;
using namespace std;
long long dp[105][100010];
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> 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++) {
      dp[i][j] = 0;
      if (j == 0) dp[i][j] = 1;
    }
  }
  dp[1][1] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      if (i == 1 && j == 1) continue;
      dp[i][j] = dp[i - 1][j] + dp[i][j - 1] % MOD;
      if (i - 1 >= 0 && j - a[i - 1] - 1 >= 0)
        dp[i][j] -= dp[i - 1][j - a[i - 1] - 1];
      if (dp[i][j] < 0) dp[i][j] += MOD;
    }
  }
  cout << dp[n][k] << endl;
  return 0;
}
