#include <bits/stdc++.h>
const char nl = '\n';
using namespace std;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const int N = 101, K = 1e5 + 10;
int n, k;
int a[N];
int dp[K][2];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < K; i++) {
    dp[i][0] = 1;
  }
  bool b = 1;
  for (int i = 0; i < n; i++, b ^= 1) {
    for (int j = 0; j <= k; j++) {
      dp[j][b] = (dp[j][b ^ 1] + MOD -
                  (j - a[i] - 1 >= 0 ? dp[j - a[i] - 1][b ^ 1] : 0)) %
                 MOD;
    }
    for (int j = 1; j <= k; j++) {
      dp[j][b] = (dp[j - 1][b] + dp[j][b]) % MOD;
    }
  }
  cout << dp[k][b ^ 1] - dp[k - 1][b ^ 1] << nl;
  return 0;
}
