#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 10, m = 1e9 + 7;
long long a[110];
long long dp[105][N];
long long go(long long i, long long k) {
  if (k < 0) return 0;
  if (k == 0) return 1;
  if (i < 0) return 0;
  long long &ans = dp[i][k];
  if (ans != -1) return ans;
  ans = (go(i - 1, k) + go(i, k - 1) - go(i - 1, k - a[i] - 1) + m) % m;
  return ans;
}
signed main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  memset(dp, -1, sizeof dp);
  long long n, k;
  cin >> n >> k;
  for (long long i = 0; i < n; ++i) cin >> a[i];
  cout << go(n - 1, k) << '\n';
  return 0;
}
