#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
long long int a[100005], dp[long long int(105)][100005], n, k;
long long int solve(long long int idx, long long int taken) {
  if (idx > n && taken != k) return 0;
  if (taken > k) return 0;
  if (taken == k) return 1;
  if (dp[idx][taken] != -1) return dp[idx][taken];
  long long int ans = 0;
  for (long long int i = 0; i <= a[idx]; i++) ans += solve(idx + 1, taken + i);
  return dp[idx][taken] = ans % mod;
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL);
  cin >> n >> k;
  for (long long int i = 0; i < 104; i++)
    for (long long int j = 0; j < 100005; j++) dp[i][j] = -1;
  for (long long int i = 1; i <= n; i++) cin >> a[i];
  cout << solve(1ll, long long int(0)) << '\n';
  return 0;
}
