#include <bits/stdc++.h>
const long long MAX = 100009, MOD = 1000000007, BASE = 311, inf = 1e9;
int du[] = {1, -1, 0, 0}, dv[] = {0, 0, -1, 1};
using namespace std;
long long n, k, a[109], f[109][MAX];
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  f[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    vector<long long> sum(k + 9, 0);
    sum[0] = f[i - 1][0];
    for (int j = 1; j <= k; j++) sum[j] = (sum[j - 1] + f[i - 1][j]) % MOD;
    for (int j = 0; j <= k; j++) {
      long long pos = j - a[i] - 1;
      if (pos >= 0)
        f[i][j] = (sum[j] - sum[pos]) % MOD;
      else
        f[i][j] = sum[j] % MOD;
    }
  }
  cout << f[n][k] << endl;
  return 0;
}
