#include <bits/stdc++.h>
using namespace std;
const long long N = 1e2 + 5, K = 1e5 + 5, inf = 1e18, mod = 1e9 + 7;
long long n, k, a[N], dp[N][K];
long long go(long long id, long long rem) {
  if (rem < 0) return 0;
  if (id > n) return rem == 0;
  long long &ways = dp[id][rem];
  if (~ways) return ways;
  ways = go(id + 1, rem);
  for (long long i = 1; i <= a[id]; i++) {
    ways = (ways + go(id + 1, rem - i)) % mod;
  }
  return ways;
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  memset(dp, -1, sizeof(dp));
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  cout << go(1, k);
}
