#include <bits/stdc++.h>
using namespace std;
long long int dp[110][100010];
long long int a[110], n, k;
long long int solve(long long int n, long long int k) {
  if (k < 0 || n < -1) return 0;
  if (k != 0 && n < 0) return 0;
  if (k == 0 && n >= -1) return 1;
  long long int ans = 0;
  if (dp[n][k] != -1) return dp[n][k];
  for (long long int i = 0; i <= min(a[n], k); i++) {
    ans = (ans + solve(n - 1, k - i)) % 1000000007;
  }
  return dp[n][k] = ans;
}
int main() {
  memset(dp, -1, sizeof(dp));
  cin >> n >> k;
  for (long long int i = 0; i < n; i++) cin >> a[i];
  cout << solve(n - 1, k) << "\n";
}
