#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int c[102], dp[102][100002];
int ways(int idx, int candies) {
  if (idx < 1) return candies == 0;
  if (candies == 0) return 1;
  int &ans = dp[idx][candies];
  if (ans != -1) return ans;
  ans = 0;
  for (int k = min(c[idx], candies); k >= 0; k--) {
    ans += ways(idx - 1, candies - k);
    ans %= mod;
  }
  return ans;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  memset(dp, -1, sizeof(dp));
  for (int i = 1; i <= n; i++) cin >> c[i];
  cout << ways(n, k);
  return 0;
}
