#include <bits/stdc++.h>
using namespace std;
long long int n, k, a[10000009];
long long int solve(int index, int candies) {
  if (index == n && a[index] < candies) return 0;
  if (index == n) return 1;
  int ans = 0;
  for (int i = 0; i <= a[index]; i++) {
    if (candies >= i) ans += solve(index + 1, candies - i) % 1000000007;
  }
  return ans % 1000000007;
}
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  cout << solve(1, k) << endl;
  return 0;
}
