#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e2 + 10, MD = 1e9 + 7;
int n, k, a[MAXN];
long long dp[MAXN][MAXN << 2];
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  dp[0][0] = 1;
  for (int i = 1; i <= n; ++i) {
    long long ans = 0;
    for (int j = 0; j <= k; ++j) {
      ans += dp[i - 1][j];
      if (j - a[i] - 1 >= 0) ans -= dp[i - 1][j - a[i] - 1];
      ans = (ans + MD) % MD;
      dp[i][j] = ans;
    }
  }
  cout << dp[n][k] << '\n';
  return 0;
}
