#include <bits/stdc++.h>
using namespace std;
const int MAXN = 110, MAXK = 100010, M = 1e9 + 7;
int n, k, a[MAXN];
long long s[MAXN], dp[MAXN][MAXK];
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) cin >> a[i], dp[i][0] = 1;
  dp[0][0] = 1;
  for (int i = 1; i <= n; ++i) {
    s[0] = 0;
    for (int j = 1; j <= k + 1; ++j) (s[j] = s[j - 1] + dp[i - 1][j - 1]) %= M;
    for (int j = 1; j <= k; ++j)
      (dp[i][j] += s[j + 1] - s[max(0, j - a[i])]) %= M;
  }
  cout << dp[n][k] << endl;
  return 0;
}
