#include <bits/stdc++.h>
using namespace std;
long long XX[8] = {+1, +1, +1, 0, 0, -1, -1, -1};
long long YY[8] = {+1, 0, -1, +1, -1, +1, 0, -1};
long long dx[4] = {-1, 1, 0, 0};
long long dy[4] = {0, 0, 1, -1};
long long n, k;
long long a[101];
long long dp[101][101];
long long solve(long long ind, long long left) {
  if (left == 0) return 1;
  if (ind == 0 or left < 0) return 0;
  long long &ans = dp[ind][left];
  if (ans != -1) return ans;
  ans = solve(ind, left - 1);
  ans = (ans + solve(ind - 1, left)) % 1000000007;
  ans = (ans - solve(ind - 1, left - a[ind - 1] - 1) + 1000000007) % 1000000007;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (long long i = 0; i < n; i++) cin >> a[i];
  memset(dp, -1, sizeof(dp));
  cout << solve(n, k) << '\n';
  return 0;
}
