#include <bits/stdc++.h>
using namespace std;
const int F = 1e5 + 5;
const long long mod = 1e9 + 7;
long long dp[105][F];
int a[105];
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  dp[0][0] = 1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= k; j++) {
      dp[i + 1][j] += dp[i][j];
      dp[i + 1][j] %= mod;
      if (j + a[i] <= k) {
        dp[i + 1][j + a[i] + 1] -= dp[i][j];
        dp[i + 1][j + a[i] + 1] %= mod;
      }
    }
    for (int j = 1; j <= k; j++)
      dp[i + 1][j] += dp[i + 1][j - 1], dp[i + 1][j] %= mod;
  }
  cout << dp[n][k] << endl;
}
