#include <bits/stdc++.h>
using namespace std;
int main(int argc, char* argv[]) {
  long n, k;
  scanf("%ld %ld", &n, &k);
  long a[101] = {0};
  vector<vector<long long> > dp(n + 1, vector<long long>(k + 1, 0));
  long i, j;
  for (i = 0; i < n; i++) {
    scanf("%ld", &(a[i]));
  }
  for (i = 0; i <= n; i++) {
    dp[i][0] = 1;
  }
  for (i = 0; i < n; i++) {
    for (j = 1; j <= k; j++) {
      if (j - 1 - a[i] >= 0) {
        dp[i + 1][j] =
            (dp[i][j] + dp[i + 1][j - 1] - dp[i][j - 1 - a[i]]) % 1000000007;
      } else {
        dp[i + 1][j] = (dp[i][j] + dp[i + 1][j - 1]) % 1000000007;
      }
    }
  }
  printf("%lld\n", dp[n][k]);
  return 0;
}
