#include <bits/stdc++.h>
using namespace std;
unsigned long long int dp[101][100001];
unsigned long long int candies(unsigned long long int *a, int n, int k) {
  if ((n == 0 && k == 0) || k == 0) return 1;
  if (n == 0) return 0;
  if (dp[n][k] > -1) return dp[n][k];
  int ans = 0;
  for (int i = 0; i <= a[0]; i++) {
    if (i <= k) ans += candies(a + 1, n - 1, k - i);
  }
  return dp[n][k] = ans;
}
int main() {
  int n, k;
  cin >> n >> k;
  memset(dp, -1, sizeof(dp));
  unsigned long long int *a = new unsigned long long int[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  unsigned long long int ans = candies(a, n, k) % 1000000007;
  cout << ans << endl;
}
