#include <bits/stdc++.h>
using namespace std;
const int M = 1e5 + 5;
const int MOD = 1e9 + 7;
int n, k, dp[102][M], t[102];
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> t[i];
  }
  for (int i = n; i >= 0; i--) {
    for (int j = 0; j <= k; j++) {
      if (i == n) {
        dp[i][j] = !j;
        continue;
      }
      dp[i][j] =
          (dp[i + 1][j] - (j - t[i] - 1 >= 0 ? dp[i + 1][j - t[i] - 1] : 0)) %
          MOD;
      if (j) dp[i][j] = (dp[i][j] + dp[i][j - 1]) % MOD;
    }
  }
  cout << dp[0][k];
}
