#include <bits/stdc++.h>
using namespace std;
long long MOD = 1e9 + 7;
int a[100];
long long dp[102][100003];
long long solve(int i, int rem, int n) {
  if (i == n + 1) return rem == 0;
  if (rem == 0) return 1;
  if (dp[i][rem] != -1) return dp[i][rem];
  int max_candies = min(a[i], rem);
  long long ans = 0;
  for (int candies = 0; candies <= max_candies; candies++)
    ans += solve(i + 1, rem - candies, n), ans %= MOD;
  return dp[i][rem] = ans;
}
int main() {
  int i, n, k;
  cin >> n >> k;
  for (i = 1; i <= n; i++) cin >> a[i];
  for (i = 1; i <= n; i++)
    for (int j = 1; j <= k; j++) dp[i][j] = -1;
  long long ans = solve(1, k, n);
  cout << ans;
  return 0;
}
