#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-8;
const int INF = 0x3F3F3F3F;
const int64_t LINF = 4611686018427387903;
const int MOD = 1e9 + 7;
int64_t sum[101][100001];
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  for (int i = 0; i <= 100000; i++) sum[0][i] = 1;
  int n, k;
  cin >> n >> k;
  vector<int> arr(n + 1);
  for (int i = 1; i <= n; i++) cin >> arr[i];
  for (int j = 1; j <= n; j++)
    for (int i = 0; i <= k; i++)
      sum[j][i] = (i ? sum[j][i - 1] : 0) + sum[j - 1][i] -
                  (i - arr[j] - 1 < 0 ? 0 : sum[j - 1][i - arr[j] - 1]) + MOD,
      sum[j][i] %= MOD;
  cout << (sum[n][k] - sum[n][k - 1] + MOD) % MOD << '\n';
  return 0;
}
