#include <bits/stdc++.h>
using namespace std;
vector<long long> arr(102);
vector<vector<long long> > dp(102, vector<long long>(100002));
const int mod = 1e9 + 7;
int main() {
  long long n, k;
  scanf("%lld%lld", &n, &k);
  for (int i = 0; i < n; i++) scanf("%lld", &arr[i]);
  vector<long long> pre(k + 1);
  for (int i = arr[0]; i >= 0; i--) dp[0][i] = 1;
  for (int i = 1; i < n; i++) {
    pre[0] = dp[i - 1][0];
    for (int j = 1; j <= k; j++) {
      pre[j] = (dp[i - 1][j] + pre[j - 1]) % mod;
    }
    for (int j = 0; j <= k; j++) {
      long long ways = pre[j] - (j - arr[i] - 1 >= 0 ? pre[j - arr[i] - 1] : 0);
      dp[i][j] = ways;
    }
  }
  printf("%lld", dp[n - 1][k]);
}
