#include <bits/stdc++.h>
using namespace std;
long long int mod = 1e9 + 7;
const int N = 1e5 + 2;
long long int dp[N][102];
long long int a[106];
long long int solve(long long int i, long long int n, long long int k) {
  if (k == 0) return 1;
  if (i > n) return 0;
  if (dp[k][i] != -1) return dp[k][i];
  long long int ans = 0;
  for (int j = 0; j <= a[i]; j++)
    if (k >= j) ans = (ans + solve(i + 1, n, k - j)) % mod;
  return dp[k][i] = ans;
}
int main() {
  int n, k;
  cin >> n >> k;
  memset(dp, -1, sizeof(dp));
  for (int i = 1; i <= n; i++) cin >> a[i];
  cout << solve(1, n, k);
}
