#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int dp[100001][100];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  memset(dp, -1, sizeof dp[0][0] * 100001 * 100);
  int n, k;
  cin >> n >> k;
  int a[100];
  for (int i = 0; i < n; i++) cin >> a[i];
  function<int(int, int)> solve = [&](int candies, int child) {
    auto &res = dp[candies][child];
    if (res != -1) return res;
    if (child == 0) {
      if (candies <= a[child])
        res = 1;
      else
        res = 0;
    } else {
      res = 0;
      for (int c = 0; c <= min(a[child], candies); c++) {
        res += solve(candies - c, child - 1);
        res %= mod;
      }
    }
    return res;
  };
  cout << solve(k, n - 1);
  return 0;
}
