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