#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int n, m;
int a[121];
long long dp[100021];
long long s[100021];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  dp[0] = 1;
  s[0] = 1;
  for (int i = 1; i <= n; ++i) {
    if (a[i] == 0) continue;
    for (int j = 1; j <= m; ++j) s[j] = (s[j - 1] + dp[j]) % MOD;
    for (int j = m; j >= 1; --j) {
      int k = j - a[i] - 1;
      dp[j] = s[j];
      if (k >= 0) dp[j] -= s[k];
      dp[j] %= MOD;
    }
  }
  printf("%lld\n", dp[m] % MOD);
  return 0;
}
